You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the bug. This is probably related to #21043, though the work done there does not appear to solve it.
Interestingly enough, the difference in sorting is ONLY observed at the first level. If your items were say at the second level there would be no difference.
In [2]: mi=pd.MultiIndex.from_tuples([[0,2,2],[0,2,1],[0,1,2],[0,1,1]], names=list('CAB'))
In [3]: a=pd.Series([1,2,3,4], index=mi)
In [5]: a.sort_index(level=1, sort_remaining=False)
Out[5]:
CAB01231422112dtype: int64In [6]: a.sort_index(level='A', sort_remaining=False)
Out[6]:
CAB01231422112dtype: int64
Perhaps - that's the same issue I found in the referenced PR #21043 though trying on that branch didn't resolve your issue. May be a similar issue somewhere else - investigation and PRs welcome!
Code Sample, a copy-pastable example if possible
returns:
Problem description
Besides A (level 0), also B (level 1) is sorted. This, despite the fact that sort_remaining is set to False.
Expected Output
By comparison, the correct result is obtained when specifying the level by its name:
with
Exactly the same result should be expected when using
level=0
instead oflevel='A'
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 32
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.22.0
pytest: None
pip: 9.0.3
setuptools: 36.4.0
Cython: None
numpy: 1.14.1
scipy: 1.0.0
pyarrow: None
xarray: 0.10.0
IPython: 5.3.0
sphinx: 1.6.3
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: 1.2.1
tables: None
numexpr: None
feather: None
matplotlib: 2.1.2
openpyxl: 2.5.0
xlrd: 1.0.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.2.3
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: