diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index d0410aa06f5b8..8680e776f8667 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -281,7 +281,7 @@ def _getitem_lowerdim(self, tup): # slices are unhashable pass except Exception, e1: - if isinstance(tup[0], slice): + if isinstance(tup[0], (slice, Index)): raise IndexingError try: loc = ax0.get_loc(tup[0]) diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index f3c07a4befbea..53b3c2ade536e 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -314,6 +314,16 @@ def test_getitem_setitem_tuple_plus_columns(self): expected = df.ix[2000, 1, 6][['A', 'B', 'C']] assert_series_equal(result, expected) + def test_getitem_multilevel_index_tuple_unsorted(self): + index_columns = list("abc") + df = DataFrame([[0, 1, 0, "x"], [0, 0, 1, "y"]] , + columns=index_columns + ["data"]) + df = df.set_index(index_columns) + query_index = df.index[:1] + rs = df.ix[query_index, "data"] + xp = Series(['x'], index=MultiIndex.from_tuples([(0, 1, 0)])) + assert_series_equal(rs, xp) + def test_xs(self): xs = self.frame.xs(('bar', 'two')) xs2 = self.frame.ix[('bar', 'two')]