Closed
Description
Code Sample
import pandas as pd
index = pd.MultiIndex(levels=[['A','B','C','D','E']] * 2, labels=[[4,4,4,3], [4,2,0,1]])
pd.Series(0, index).unstack()
Problem description
In Pandas 0.20, 0.21, and 0.22, this gave the expected result:
A B C E
D NaN 0.0 NaN NaN
E 0.0 NaN 0.0 0.0
But in Pandas 0.23, the result is not sorted:
E C A B
E 0.0 0.0 0.0 NaN
D NaN NaN NaN 0.0
The documentation says "The level involved will automatically get sorted", and while I've seen the explanation of confusing implementation details leaking out in #15105 and some other outright bugs in #9514, this seems to be a different bug, and a regression.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.4.final.0
python-bits: 64
OS: Linux
machine: x86_64
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.21.1
numpy: 1.13.1