Skip to content

Commit 927d439

Browse files
committed
If we have an empty seq, then we should return True.
1 parent 62cbc27 commit 927d439

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
@@ -2379,13 +2379,18 @@ def _check_equal_length(seq_of_seqs):
23792379
A TypeError will be raised if inner sequence does not support len().
23802380
23812381
Return True if all sequences are the same length, otherwise False
2382+
If seq_of_seqs is empty return True as well.
23822383
"""
23832384
seq_it = iter(seq_of_seqs)
2384-
L0 = len(next(seq_it))
2385-
for seq in seq_it:
2386-
if len(seq) != L0:
2387-
return False
2388-
return True
2385+
try:
2386+
L0 = len(next(seq_it))
2387+
except StopIteration:
2388+
return True
2389+
else:
2390+
for seq in seq_it:
2391+
if len(seq) != L0:
2392+
return False
2393+
return True
23892394

23902395

23912396
def _get_na_rep(dtype):

0 commit comments

Comments
 (0)