pydata/pandas — pull request #6134 by y-p (2014-01-27 23:12:15+00:00)
Title: ENH: add per axis, per level indexing with tuples using loc

Selection only. Did not check (nor care) about performance at this point.
Full Tests, vbenches and docs to follow in due course.

Please hold off on PEP8 comments, and suggestions on how this could be made more complex.
I'd like to get something functional, solid and understandable in master fairly early in 0.14.

@jreback, I don't often wade this deep into the gore. Would welcome your
review and suggestions.

xref: #5641, #3057, #4036, and others

```python
In [1]:
...: def mklbl(prefix,n):
...: return ["%s%s" % (prefix,i) for i in range(n)]
...:
...: ix =pd.MultiIndex.from_product([mklbl('A',5),mklbl('B',7),mklbl('C',4),mklbl('D',2)])
...: df=pd.DataFrame(range(len(ix.get_values())),index=ix)
```
```python
In [2]: df.loc[(slice('A1','A3'),slice(None), ['C1','C3']),:]
Out[2]:
0
A1 B0 C1 D0 58
D1 59
C3 D0 62
D1 63
B1 C1 D0 66
D1 67
C3 D0 70
D1 71
B2 C1 D0 74
D1 75
C3 D0 78
D1 79
B3 C1 D0 82
D1 83
C3 D0 86
D1 87
B4 C1 D0 90
D1 91
C3 D0 94
D1 95
B5 C1 D0 98
D1 99
C3 D0 102
D1 103
B6 C1 D0 106
D1 107
C3 D0 110
D1 111
A2 B0 C1 D0 114
D1 115
C3 D0 118
D1 119
B1 C1 D0 122
D1 123
C3 D0 126
D1 127
B2 C1 D0 130
D1 131
C3 D0 134
D1 135
...

[56 rows x 1 columns]
```