TST/DEPR: remove .ix from tests\indexing\multiindex\test_loc.py
State: closed

follow on from #26438

i leave this as draft until #26438 is merged, to prevent this one being merged first.

not used `iloc` for the expected where dropping levels would be required, used df.values instead.

Labels:
name: Deprecate
description: Functionality to remove in pandas
name: Index
description: Related to the Index class or subclasses

Comments:
@simonjayhawkins can you rebase
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=h1) Report
> Merging [#26451](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5a286e458f9693351c83eeaa5c484dfdd654e65c?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26451/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26451      +/-   ##
==========================================
- Coverage   91.74%   91.73%   -0.01%     
==========================================
  Files         174      174              
  Lines       50746    50746              
==========================================
- Hits        46555    46551       -4     
- Misses       4191     4195       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.23% <ø> (ø)` | :arrow_up: |
| #single | `41.69% <ø> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26451/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26451/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.02% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=footer). Last update [5a286e4...64d51de](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=h1) Report
> Merging [#26451](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5a286e458f9693351c83eeaa5c484dfdd654e65c?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26451/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26451      +/-   ##
==========================================
- Coverage   91.74%   91.73%   -0.01%     
==========================================
  Files         174      174              
  Lines       50746    50748       +2     
==========================================
- Hits        46555    46553       -2     
- Misses       4191     4195       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.24% <ø> (ø)` | :arrow_up: |
| #single | `41.69% <ø> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26451/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26451/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.02% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/26451/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `94.08% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=footer). Last update [5a286e4...82e0fcc](https://codecov.io/gh/pandas-dev/pandas/pull/26451?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

> generally we don't want to use `DataFrame.values` instead prefer `.iloc`

and then follow with `droplevel`?
> and then follow with droplevel?

yes I think the 2nd is more idiomatic

```
In [8]: pd.DataFrame(df.values[[0, 1]], index=['X', 'X'], columns=df.columns)                                                                                                                                                                                                      
Out[8]: 
          i                   j
          A         A         B
X  1.394995 -0.547172  0.790848
X  0.233443 -0.124027  1.298484

In [9]: df.iloc[[0,1]].droplevel(0)                                                                                                                                                                                                                                                
Out[9]: 
          i                   j
          A         A         B
X  1.394995 -0.547172  0.790848
X  0.233443 -0.124027  1.298484

```
the straight sub fails a couple of tests, i've just commited that to show the failing cases.

next commit using droplevel.
thanks @simonjayhawkins nice clean up!