@@ -63,15 +63,6 @@ class Styler(object):
63
63
a unique identifier to avoid CSS collisons; generated automatically
64
64
caption: str, default None
65
65
caption to attach to the table
66
- index: bool, default True
67
- determines if the index is rendered in the html output
68
-
69
- .. versionadded:: 0.21.0
70
-
71
- hidden_columns: IndexSlice, default None
72
- hides a subset of columns from rendering
73
-
74
- .. versionadded:: 0.21.0
75
66
76
67
Attributes
77
68
----------
@@ -120,8 +111,7 @@ class Styler(object):
120
111
template = env .get_template ("html.tpl" )
121
112
122
113
def __init__ (self , data , precision = None , table_styles = None , uuid = None ,
123
- caption = None , table_attributes = None , index = True ,
124
- hidden_columns = None ):
114
+ caption = None , table_attributes = None ):
125
115
self .ctx = defaultdict (list )
126
116
self ._todo = []
127
117
@@ -143,10 +133,8 @@ def __init__(self, data, precision=None, table_styles=None, uuid=None,
143
133
precision = get_option ('display.precision' )
144
134
self .precision = precision
145
135
self .table_attributes = table_attributes
146
- self .index_visible = index
147
- if hidden_columns is None :
148
- hidden_columns = []
149
- self .hidden_columns = hidden_columns
136
+ self .hidden_index = False
137
+ self .hidden_columns = []
150
138
151
139
# display_funcs maps (row, col) -> formatting function
152
140
@@ -195,7 +183,7 @@ def _translate(self):
195
183
caption = self .caption
196
184
ctx = self .ctx
197
185
precision = self .precision
198
- index_visible = self .index_visible
186
+ hidden_index = self .hidden_index
199
187
hidden_columns = self .hidden_columns
200
188
uuid = self .uuid or str (uuid1 ()).replace ("-" , "_" )
201
189
ROW_HEADING_CLASS = "row_heading"
@@ -234,7 +222,7 @@ def format_attr(pair):
234
222
row_es = [{"type" : "th" ,
235
223
"value" : BLANK_VALUE ,
236
224
"display_value" : BLANK_VALUE ,
237
- "is_visible" : index_visible ,
225
+ "is_visible" : not hidden_index ,
238
226
"class" : " " .join ([BLANK_CLASS ])}] * (n_rlvls - 1 )
239
227
240
228
# ... except maybe the last for columns.names
@@ -246,7 +234,7 @@ def format_attr(pair):
246
234
"value" : name ,
247
235
"display_value" : name ,
248
236
"class" : " " .join (cs ),
249
- "is_visible" : index_visible })
237
+ "is_visible" : not hidden_index })
250
238
251
239
if clabels :
252
240
for c , value in enumerate (clabels [r ]):
@@ -296,8 +284,8 @@ def format_attr(pair):
296
284
"row{row}" .format (row = r )]
297
285
es = {
298
286
"type" : "th" ,
299
- "is_visible" : (_is_visible (r , c , idx_lengths ) &
300
- index_visible ),
287
+ "is_visible" : (_is_visible (r , c , idx_lengths ) and
288
+ not hidden_index ),
301
289
"value" : value ,
302
290
"display_value" : value ,
303
291
"id" : "_" .join (rid [1 :]),
@@ -477,9 +465,7 @@ def _update_ctx(self, attrs):
477
465
def _copy (self , deepcopy = False ):
478
466
styler = Styler (self .data , precision = self .precision ,
479
467
caption = self .caption , uuid = self .uuid ,
480
- table_styles = self .table_styles ,
481
- index = self .index_visible ,
482
- hidden_columns = self .hidden_columns )
468
+ table_styles = self .table_styles )
483
469
if deepcopy :
484
470
styler .ctx = copy .deepcopy (self .ctx )
485
471
styler ._todo = copy .deepcopy (self ._todo )
@@ -816,7 +802,7 @@ def hide_index(self):
816
802
-------
817
803
self : Styler
818
804
"""
819
- self .index_visible = False
805
+ self .hidden_index = True
820
806
return self
821
807
822
808
def hide_columns (self , subset ):
0 commit comments