@@ -351,12 +351,6 @@ def _translate(self):
351
351
Convert the DataFrame in `self.data` and the attrs from `_build_styles`
352
352
into a dictionary of {head, body, uuid, cellstyle}.
353
353
"""
354
- table_styles = self .table_styles or []
355
- caption = self .caption
356
- ctx = self .ctx
357
- hidden_index = self .hidden_index
358
- hidden_columns = self .hidden_columns
359
- uuid = self .uuid
360
354
ROW_HEADING_CLASS = "row_heading"
361
355
COL_HEADING_CLASS = "col_heading"
362
356
INDEX_NAME_CLASS = "index_name"
@@ -365,12 +359,22 @@ def _translate(self):
365
359
BLANK_CLASS = "blank"
366
360
BLANK_VALUE = ""
367
361
362
+ # mapping variables
363
+ ctx = self .ctx # td css styles from apply() and applymap()
364
+ cell_context = self .cell_context # td css classes from set_td_classes()
365
+ cellstyle_map : DefaultDict [Tuple [CSSPair , ...], List [str ]] = defaultdict (list )
366
+
367
+ # copied attributes
368
+ table_styles = self .table_styles or []
369
+ caption = self .caption
370
+ hidden_index = self .hidden_index
371
+ hidden_columns = self .hidden_columns
372
+ uuid = self .uuid
373
+
368
374
# for sparsifying a MultiIndex
369
375
idx_lengths = _get_level_lengths (self .index )
370
376
col_lengths = _get_level_lengths (self .columns , hidden_columns )
371
377
372
- cell_context = self .cell_context
373
-
374
378
n_rlvls = self .data .index .nlevels
375
379
n_clvls = self .data .columns .nlevels
376
380
rlabels = self .data .index .tolist ()
@@ -382,10 +386,7 @@ def _translate(self):
382
386
clabels = [[x ] for x in clabels ]
383
387
clabels = list (zip (* clabels ))
384
388
385
- cellstyle_map : DefaultDict [Tuple [CSSPair , ...], List [str ]] = defaultdict (list )
386
-
387
389
head = []
388
-
389
390
for r in range (n_clvls ):
390
391
# Blank for Index columns...
391
392
row_es = [
0 commit comments