Skip to content

Commit 92751ce

Browse files
committed
BUG: Fix indexing MultiIndex with Series with 0 not index
1 parent f65a641 commit 92751ce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/core/indexing.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,18 @@ def _getitem_axis(self, key, axis=0):
15251525
# possibly convert a list-like into a nested tuple
15261526
# but don't convert a list-like of tuples
15271527
if isinstance(labels, MultiIndex):
1528+
if isinstance(key, ABCSeries):
1529+
# GH 14730
1530+
key = key.values.tolist()
1531+
elif isinstance(key, ABCDataFrame):
1532+
# GH 15438
1533+
raise NotImplementedError("Indexing a MultiIndex with a DataFrame "
1534+
"key is not implemented")
1535+
elif hasattr(key, 'ndim') and key.ndim > 1:
1536+
raise NotImplementedError("Indexing a MultiIndex with a multidimensional "
1537+
"key is not implemented")
15281538
if (not isinstance(key, tuple) and len(key) > 1 and
15291539
not isinstance(key[0], tuple)):
1530-
if isinstance(key, ABCSeries):
1531-
# GH 14730
1532-
key = list(key)
15331540
key = tuple([key])
15341541

15351542
# an iterable multi-selection

0 commit comments

Comments
 (0)