Repository: pandas-dev/pandas

Issue:
BUG: loc with a multi-index and a list incorrectly selecting by position
from [SO](http://stackoverflow.com/questions/24056277/pandas-use-array-index-all-values)

This is a bug; the first should work like the 2nd (it is incorrectly selecting by position); essentially this is `.ix` fallback type behavior

```
In [10]: df = DataFrame(np.arange(12).reshape(-1,1),index=pd.MultiIndex.from_product([[1,2,3,4],[1,2,3]]))

In [11]: df.loc[[1,2]]
Out[11]: 
     0
1 2  1
  3  2

In [12]: df.loc[([1,2],),:]
Out[12]: 
     0
1 1  0
  2  1
  3  2
2 1  3
  2  4
  3  5
```



Discussion:

Resolving patch:
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -1243,23 +1243,37 @@ def _getitem_axis(self, key, axis=0, validate_iterable=False):
             return self._get_slice_axis(key, axis=axis)
         elif com._is_bool_indexer(key):
             return self._getbool_axis(key, axis=axis)
-        elif _is_list_like(key) and not (isinstance(key, tuple) and
-                                         isinstance(labels, MultiIndex)):
+        elif _is_list_like(key):
 
-            if hasattr(key, 'ndim') and key.ndim > 1:
-                raise ValueError('Cannot index with multidimensional key')
+            # GH 7349
+            # possibly convert a list-like into a nested tuple
+            # but don't convert a list-like of tuples
+            if isinstance(labels, MultiIndex):
+                if not isinstance(key, tuple) and len(key) > 1 and not isinstance(key[0], tuple):
+                    key = tuple([key])
 
-            if validate_iterable:
-                self._has_valid_type(key, axis)
-            return self._getitem_iterable(key, axis=axis)
-        elif _is_nested_tuple(key, labels):
-            locs = labels.get_locs(key)
-            indexer = [ slice(None) ] * self.ndim
-            indexer[axis] = locs
-            return self.obj.iloc[tuple(indexer)]
-        else:
-            self._has_valid_type(key, axis)
-            return self._get_label(key, axis=axis)
+            # an iterable multi-selection
+            if not (isinstance(key, tuple) and
+                    isinstance(labels, MultiIndex)):
+
+                if hasattr(key, 'ndim') and key.ndim > 1:
+                    raise ValueError('Cannot index with multidimensional key')
+
+                if validate_iterable:
+                    self._has_valid_type(key, axis)
+
+                return self._getitem_iterable(key, axis=axis)
+
+            # nested tuple slicing
+            if _is_nested_tuple(key, labels):
+                locs = labels.get_locs(key)
+                indexer = [ slice(None) ] * self.ndim
+                indexer[axis] = locs
+                return self.obj.iloc[tuple(indexer)]
+
+        # fall thru to straight lookup
+        self._has_valid_type(key, axis)
+        return self._get_label(key, axis=axis)
 
 
 class _iLocIndexer(_LocationIndexer):


Test patch:
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -1317,6 +1317,15 @@ def test_loc_multiindex(self):
         result = df[attributes]
         assert_frame_equal(result, df)
 
+        # GH 7349
+        # loc with a multi-index seems to be doing fallback
+        df = DataFrame(np.arange(12).reshape(-1,1),index=pd.MultiIndex.from_product([[1,2,3,4],[1,2,3]]))
+
+        expected = df.loc[([1,2],),:]
+        result = df.loc[[1,2]]
+        assert_frame_equal(result, expected)
+
+
     def test_series_getitem_multiindex(self):
 
         # GH 6018