Skip to content

Commit 9022f54

Browse files
committed
avoid materialising list unnecessarily
1 parent 0b703cd commit 9022f54

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pandas/io/formats/style_render.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -956,14 +956,11 @@ def concatenated_visible_rows(obj):
956956
visible_index_levels: list[int] = [
957957
i for i in range(index_levels) if not self.hide_index_[i]
958958
]
959-
target_index_levels: list[int] = [
960-
i
961-
for i in range(index_levels)
962-
if "invisible" in clines or not self.hide_index_[i]
963-
]
964959
for rn, r in enumerate(visible_row_indexes):
965960
lvln = 0
966-
for lvl in target_index_levels:
961+
for lvl in range(index_levels):
962+
if self.hide_index_[lvl] and "invisible" not in clines:
963+
continue
967964
if lvl == index_levels - 1 and "skip-last" in clines:
968965
continue
969966
idx_len = d["index_lengths"].get((lvl, r), None)

0 commit comments

Comments
 (0)