Skip to content

Commit bf08d73

Browse files
committed
Fix indexing MultiIndex with NDFrames
1 parent 5a8883b commit bf08d73

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/core/indexing.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,13 @@ 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+
key = [tuple(k) for k in key.values.tolist()]
15281533
if (not isinstance(key, tuple) and len(key) > 1 and
15291534
not isinstance(key[0], tuple)):
1530-
if isinstance(key, ABCSeries):
1531-
# GH 14730
1532-
key = list(key)
15331535
key = tuple([key])
15341536

15351537
# an iterable multi-selection

0 commit comments

Comments
 (0)