BUG: Bug in multi-index slicing with various edge cases (GH8132)
State: closed

closes #8132 

```
# A1 - Works - Get all values under "A0" and "A1"
df1.loc[(slice('A1')),:]

                  VALUES
A  B  DATE              
A0 B0 2013-06-11      22
      2013-07-02      35
   B1 2013-07-09      14
      2013-07-30       9
   B2 2013-08-06       4
A1 B0 2013-06-11      40
      2013-07-02      18
   B1 2013-07-09       4
      2013-07-30       2
   B2 2013-08-06       5
```

```
# A2 - Works - Get all values from the start to "A2"
df1.loc[(slice('A2')),:]

                  VALUES
A  B  DATE              
A0 B0 2013-06-11      22
      2013-07-02      35
   B1 2013-07-09      14
      2013-07-30       9
   B2 2013-08-06       4
A1 B0 2013-06-11      40
      2013-07-02      18
   B1 2013-07-09       4
      2013-07-30       2
   B2 2013-08-06       5
A2 B0 2013-09-03       1
      2013-10-01       2
   B1 2013-07-09       3
      2013-08-06       4
   B2 2013-09-03       2
```

```
# A3 - Works - Get all values under "B1" or "B2"
df1.loc[(slice(None),slice('B1','B2')),:]

                  VALUES
A  B  DATE              
A0 B1 2013-07-09      14
      2013-07-30       9
   B2 2013-08-06       4
A1 B1 2013-07-09       4
      2013-07-30       2
   B2 2013-08-06       5
A2 B1 2013-07-09       3
      2013-08-06       4
   B2 2013-09-03       2
```

```
# A4 - Works - Get all values between 2013-07-02 and 2013-07-09
df1.loc[(slice(None),slice(None),slice('20130702','20130709')),:]

                  VALUES
A  B  DATE              
A0 B0 2013-07-02      35
   B1 2013-07-09      14
A1 B0 2013-07-02      18
   B1 2013-07-09       4
A2 B1 2013-07-09       3
```

```
# B1 -  Get all values in B0 that are also under A0, A1 and A2
df1.loc[(slice('A2'),slice('B0')),:]

                  VALUES
A  B  DATE              
A0 B0 2013-06-11      22
      2013-07-02      35
A1 B0 2013-06-11      40
      2013-07-02      18
A2 B0 2013-09-03       1
      2013-10-01       2
```

```
# B2 - Get all values in B0, B1 and B2 (similar to what #2 is doing for the As)
df1.loc[(slice(None),slice('B2')),:]

                 VALUES
A  B  DATE              
A0 B0 2013-06-11      22
      2013-07-02      35
   B1 2013-07-09      14
      2013-07-30       9
   B2 2013-08-06       4
A1 B0 2013-06-11      40
      2013-07-02      18
   B1 2013-07-09       4
      2013-07-30       2
   B2 2013-08-06       5
A2 B0 2013-09-03       1
      2013-10-01       2
   B1 2013-07-09       3
      2013-08-06       4
   B2 2013-09-03       2
```

```
# B3 - Get all values from B1 to B2 and up to 2013-08-06
df1.loc[(slice(None),slice('B1','B2'),slice('2013-08-06')),:]

                  VALUES
A  B  DATE              
A0 B1 2013-07-09      14
      2013-07-30       9
   B2 2013-08-06       4
A1 B1 2013-07-09       4
      2013-07-30       2
   B2 2013-08-06       5
A2 B1 2013-07-09       3
      2013-08-06       4
```

```
# B4 - Same as A4 but the start of the date slice is not a key.
df1.loc[(slice(None),slice(None),slice('20130701','20130709')),:]
                  VALUES
A  B  DATE              
A0 B0 2013-07-02      35
   B1 2013-07-09      14
A1 B0 2013-07-02      18
   B1 2013-07-09       4
A2 B1 2013-07-09       3
```


Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: MultiIndex

Comments:
@jreback I suppose it is due to the copy/pasting, but a lot the example cases above have not really the correct output (eg A2, A3, A4 have a wrong output, but these are correctly tested in your tests)

It IS copy-pasted (and prob screwed it up).

Ah, hadn't yet refreshed probably, looks ok now!