@@ -1550,37 +1550,28 @@ def _getitem_axis(self, key, axis=0):
1550
1550
elif is_bool_indexer (key ):
1551
1551
return self ._getbool_axis (key , axis = axis )
1552
1552
elif is_list_like_indexer (key ):
1553
+ if isinstance (key , ABCDataFrame ):
1554
+ # GH 15438
1555
+ raise NotImplementedError ("Indexing a with a DataFrame key is "
1556
+ "not implemented" )
1557
+ elif hasattr (key , 'ndim' ) and key .ndim > 1 :
1558
+ raise NotImplementedError ("Indexing with a multidimensional "
1559
+ "key is not implemented" )
1553
1560
1554
1561
# convert various list-like indexers
1555
1562
# to a list of keys
1556
1563
# we will use the *values* of the object
1557
1564
# and NOT the index if its a PandasObject
1558
1565
if isinstance (labels , MultiIndex ):
1559
-
1560
- if isinstance (key , (ABCSeries , np .ndarray )) and key .ndim <= 1 :
1561
- # Series, or 0,1 ndim ndarray
1566
+ if isinstance (key , (ABCSeries , np .ndarray )) and key .ndim != 1 :
1567
+ # Series or 1-dim ndarray
1562
1568
# GH 14730
1563
1569
key = list (key )
1564
- elif isinstance (key , ABCDataFrame ):
1565
- # GH 15438
1566
- raise NotImplementedError ("Indexing a MultiIndex with a "
1567
- "DataFrame key is not "
1568
- "implemented" )
1569
- elif hasattr (key , 'ndim' ) and key .ndim > 1 :
1570
- raise NotImplementedError ("Indexing a MultiIndex with a "
1571
- "multidimensional key is not "
1572
- "implemented" )
1573
-
1574
- if (not isinstance (key , tuple ) and len (key ) > 1 and
1575
- not isinstance (key [0 ], tuple )):
1576
- key = tuple ([key ])
1570
+ if not isinstance (key , tuple ):
1571
+ return self ._getitem_iterable (key , axis = axis )
1577
1572
1578
1573
# an iterable multi-selection
1579
- if not (isinstance (key , tuple ) and isinstance (labels , MultiIndex )):
1580
-
1581
- if hasattr (key , 'ndim' ) and key .ndim > 1 :
1582
- raise ValueError ('Cannot index with multidimensional key' )
1583
-
1574
+ else :
1584
1575
return self ._getitem_iterable (key , axis = axis )
1585
1576
1586
1577
# nested tuple slicing
0 commit comments