Skip to content

Commit b0060c5

Browse files
committed
If we have an empty seq, then we should return True.
1 parent 86a7dd4 commit b0060c5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pandas/indexes/multi.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,13 +2339,18 @@ def _check_equal_length(seq_of_seqs):
23392339
A TypeError will be raised if inner sequence does not support len().
23402340
23412341
Return True if all sequences are the same length, otherwise False
2342+
If seq_of_seqs is empty return True as well.
23422343
"""
23432344
seq_it = iter(seq_of_seqs)
2344-
L0 = len(next(seq_it))
2345-
for seq in seq_it:
2346-
if len(seq) != L0:
2347-
return False
2348-
return True
2345+
try:
2346+
L0 = len(next(seq_it))
2347+
except StopIteration:
2348+
return True
2349+
else:
2350+
for seq in seq_it:
2351+
if len(seq) != L0:
2352+
return False
2353+
return True
23492354

23502355

23512356
def _get_na_rep(dtype):

0 commit comments

Comments
 (0)