File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -561,15 +561,19 @@ 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 :
571
+ continue
572
+ c = c .rstrip (";" )
573
+ if not c :
574
+ continue
575
+ i = rowi [rn ]
576
+ for pair in c .split (";" ):
573
577
self .ctx [(i , j )].append (pair )
574
578
575
579
def _copy (self , deepcopy : bool = False ) -> "Styler" :
You can’t perform that action at this time.
0 commit comments