Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/reshape/reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def _stack_multi_column_index(columns: MultiIndex) -> MultiIndex | Index:

levs = (
[lev[c] if c >= 0 else None for c in codes]
for lev, codes in zip(columns.levels[:-1], columns.codes[:-1])
for lev, codes in zip(columns.levels[:-1], columns.codes[:-1], strict = True)
)

# Remove duplicate tuples in the MultiIndex.
Expand All @@ -792,7 +792,7 @@ def _stack_multi_column_index(columns: MultiIndex) -> MultiIndex | Index:
[
# Not all indices can accept None values.
Index(new_lev, dtype=lev.dtype) if None not in new_lev else new_lev
for new_lev, lev in zip(new_levs, columns.levels)
for new_lev, lev in zip(new_levs, columns.levels, strict = True)
],
names=columns.names[:-1],
)
Expand Down
Loading