Skip to content

Commit

Permalink
Isolate the exact array shape when issue occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
summonholmes authored and summonholmes committed Jan 12, 2019
1 parent da274d9 commit cde96f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5282,7 +5282,7 @@ def ensure_index(index_like, copy=False):
if len(converted) > 0 and all_arrays:
from .multi import MultiIndex
return MultiIndex.from_arrays(converted)
elif converted.size > 2:
elif converted.shape == (1, 2, 2):
# When nested tuples are incorrectly converted
# to > 2 dimensions (Extremely rare)
index_like = np.ndarray((1, 2), dtype=tuple)
Expand Down

1 comment on commit cde96f8

@summonholmes
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the tests were failing due to indexing errors. Therefore, I made this catch more specific to the specific edge case. There may be more to do, especially if nested tuples become far too nested.

Please sign in to comment.