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
importpandasaspdimportnumpyasnpn=5# not a problem for n < 5df=pd.DataFrame({
'x': pd.Categorical(np.repeat([1, 2, 3, 4], n), ordered=True)
})
df.sort_values('x', kind='mergesort')
When sorting (using mergesort) a dataframe by an ordered categorical column, the sorting should be stable. In the example above x==2 and x==4 the values have been scrambled.
Expected Output
The index should remain in order since the column is already sorted.
output:
Problem description
When sorting (using mergesort) a dataframe by an ordered categorical column, the sorting should be stable. In the example above
x==2
andx==4
the values have been scrambled.Expected Output
The index should remain in order since the column is already sorted.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.11.1-gentoo
machine: x86_64
processor: Intel(R)
byteorder: little
LC_ALL: en_US.utf8
LANG: en_US.utf8
LOCALE: en_US.UTF-8
pandas: 0.20.2
pytest: 3.1.2
pip: 9.0.1
setuptools: 36.0.1
Cython: 0.25.2
numpy: 1.13.0
scipy: 0.19.1
xarray: None
IPython: 6.1.0
sphinx: 1.6.2
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: