File tree 1 file changed +11
-9
lines changed 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -561,15 +561,17 @@ def _update_ctx(self, attrs: DataFrame) -> None:
561
561
Whitespace shouldn't matter and the final trailing ';' shouldn't
562
562
matter.
563
563
"""
564
- rows = [(row_label , v ) for row_label , v in attrs .iterrows ()]
565
- row_idx = self .index .get_indexer ([x [0 ] for x in rows ])
566
- for ii , row in enumerate (rows ):
567
- i = row_idx [ii ]
568
- cols = [(col_label , col ) for col_label , col in row [1 ].items () if col ]
569
- col_idx = self .columns .get_indexer ([x [0 ] for x in cols ])
570
- for jj , itm in enumerate (cols ):
571
- j = col_idx [jj ]
572
- for pair in itm [1 ].rstrip (";" ).split (";" ):
564
+ coli = {k : i for i , k in enumerate (self .columns )}
565
+ rowi = {k : i for i , k in enumerate (self .index )}
566
+ for jj in range (len (attrs .columns )):
567
+ cn = attrs .columns [jj ]
568
+ j = coli [cn ]
569
+ for rn , c in attrs [[cn ]].itertuples ():
570
+ if not c : continue
571
+ c = c .rstrip (";" )
572
+ if not c : continue
573
+ i = rowi [rn ]
574
+ for pair in c .split (";" ):
573
575
self .ctx [(i , j )].append (pair )
574
576
575
577
def _copy (self , deepcopy : bool = False ) -> "Styler" :
You can’t perform that action at this time.
0 commit comments