Skip to content

uint64 multicolumn sort #9918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scottupdike opened this issue Apr 16, 2015 · 2 comments · Fixed by #29365
Closed

uint64 multicolumn sort #9918

scottupdike opened this issue Apr 16, 2015 · 2 comments · Fixed by #29365
Labels
Dtype Conversions Unexpected or buggy dtype conversions good first issue Needs Tests Unit test(s) needed to prevent regressions Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@scottupdike
Copy link

Sorting uint64 columns is incorrect when sorting on multiple columns:

>>> import pandas as pd
>>> import numpy as np
>>> df = pd.DataFrame({'a': pd.Series([18446637057563306014, 1162265347240853609]), 'b': pd.Series([1, 2])})
>>> df['a'] = df['a'].astype(np.uint64)
>>> df.sort(['a', 'b'])['a']
0    18446637057563306014
1     1162265347240853609
Name: a, dtype: uint64
>>> df.sort(['a'])['a']
1     1162265347240853609
0    18446637057563306014
Name: a, dtype: uint64
>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-40.87-jump1.03
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.15.2
nose: 1.3.4
Cython: None
numpy: 1.9.1
scipy: 0.15.1
statsmodels: None
IPython: 2.3.1
sphinx: None
patsy: None
dateutil: 2.4.0
pytz: 2014.10
bottleneck: None
tables: None
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: None
pymysql: None
psycopg2: None
@jreback jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations Difficulty Intermediate labels Apr 16, 2015
@jreback jreback added this to the Next Major Release milestone Apr 16, 2015
@jreback
Copy link
Contributor

jreback commented Apr 16, 2015

uint64 not super-well supported; marked as a bug

@mroeschke
Copy link
Member

This looks to work on master. Could use a test:

In [59]: >>> df = pd.DataFrame({'a': pd.Series([18446637057563306014, 1162265347240853609]), 'b': pd.Series([1, 2])})
    ...: >>> df['a'] = df['a'].astype(np.uint64)
    ...: >>> df.sort_values(['a', 'b'])['a']
Out[59]:
1     1162265347240853609
0    18446637057563306014
Name: a, dtype: uint64

In [60]: df.sort_values(['a'])['a']
Out[60]:
1     1162265347240853609
0    18446637057563306014
Name: a, dtype: uint64

In [61]: pd.__version__
Out[61]: '0.26.0.dev0+593.g9d45934af'

@mroeschke mroeschke added good first issue Needs Tests Unit test(s) needed to prevent regressions and removed Bug Difficulty Intermediate Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations labels Oct 20, 2019
@jreback jreback modified the milestones: Contributions Welcome, 1.0 Nov 3, 2019
@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions good first issue Needs Tests Unit test(s) needed to prevent regressions Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants