Skip to content

Commit eca6a66

Browse files
authored
Fix zip function to enforce strict matching
1 parent 590cd2f commit eca6a66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/reshape/reshape.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def _stack_multi_column_index(columns: MultiIndex) -> MultiIndex | Index:
778778

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

784784
# Remove duplicate tuples in the MultiIndex.
@@ -792,7 +792,7 @@ def _stack_multi_column_index(columns: MultiIndex) -> MultiIndex | Index:
792792
[
793793
# Not all indices can accept None values.
794794
Index(new_lev, dtype=lev.dtype) if None not in new_lev else new_lev
795-
for new_lev, lev in zip(new_levs, columns.levels)
795+
for new_lev, lev in zip(new_levs, columns.levels, strict = True)
796796
],
797797
names=columns.names[:-1],
798798
)

0 commit comments

Comments
 (0)