BUG: MultiIndex sort with ascending as list
State: closed

MultiIndex sorting with `sort_index` would fail when the `ascending`
argument was specified as a list but not all levels of the index were
specified in the `level` argument, or the levels were specified in
a different order to the MultiIndex.

 - [X] closes #16934
 - [X] tests added / passed
 - [X] passes ``git diff upstream/master -u -- "*.py" | flake8 --diff``
 - [X] whatsnew entry

Labels:
name: Bug
name: MultiIndex

Comments:
Hello @alubbock! Thanks for updating the PR.

 - In the file [`pandas/core/indexes/multi.py`](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py), following are the PEP8 issues :

> [Line 643:9](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L643): [E741](https://duckduckgo.com/?q=pep8%20E741) ambiguous variable name 'l'
> [Line 851:17](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L851): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 856:17](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L856): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 1460:9](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L1460): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 2051:17](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L2051): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 2545:17](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/core/indexes/multi.py#L2545): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'

 - In the file [`pandas/tests/test_multilevel.py`](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/tests/test_multilevel.py), following are the PEP8 issues :

> [Line 1360:9](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/tests/test_multilevel.py#L1360): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 1399:13](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/tests/test_multilevel.py#L1399): [E731](https://duckduckgo.com/?q=pep8%20E731) do not assign a lambda expression, use a def
> [Line 1467:13](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/tests/test_multilevel.py#L1467): [E731](https://duckduckgo.com/?q=pep8%20E731) do not assign a lambda expression, use a def
> [Line 2002:9](https://github.com/pandas-dev/pandas/blob/79359fd11235199d54f75785ddcc363cdfeb4351/pandas/tests/test_multilevel.py#L2002): [E741](https://duckduckgo.com/?q=pep8%20E741) ambiguous variable name 'l'



##### Comment last updated on July 15, 2017 at 15:02 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=h1) Report
> Merging [#16937](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ad24759871ea43131711cfce1e5fc69c06d82956?src=pr&el=desc) will **decrease** coverage by `0.03%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #16937      +/-   ##
==========================================
- Coverage   90.99%   90.96%   -0.04%     
==========================================
  Files         161      161              
  Lines       49306    49306              
==========================================
- Hits        44868    44850      -18     
- Misses       4438     4456      +18
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.73% <100%> (-0.02%)` | :arrow_down: |
| #single | `40.19% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `96.91% <100%> (+0.24%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16937?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/16937?src=pr&el=footer). Last update [ad24759...79359fd](https://codecov.io/gh/pandas-dev/pandas/pull/16937?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

FYI: ignore the PEP8 bot comments.  We are experimenting with that ATM.
ping on green
thanks!