-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Factorize don't preserve na_sentinel values when sort is specified #25409
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
Comments
@rahulnair23 Thanks for the report! This is indeed clearly a bug (it seems to be a regression as well, although not in the last release. It also fails in 0.23.4, but works correctly in 0.22.0) |
This seems to be due to the use of `take_1d:
but I think this is actually a wrong usage of So if we want to use this faster path with |
Removing |
@gfyoung there is a reason I added it explicitly to the milestone: it is still a recent regression, it is related to the refactoring we did, and I already basically mentioned how to solve it. Therefore, I think it could be good to include it. So added back the milestone, to at least keep it in view for a bugfix release (we can always postpone it later). |
@TomAugspurger do you remember if the usage of |
Alternatively, we could also (for short term fix), check if |
I don't recall, sorry. |
Code Sample, a copy-pastable example if possible
Problem description
Calls to
factorize
with a na_sentinel value set andsort=True
appears not to respect the na_sentinel values specified.Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Darwin
OS-release: 18.2.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_IE.UTF-8
LOCALE: en_IE.UTF-8
pandas: 0.24.1
pytest: None
pip: 18.1
setuptools: 40.6.3
Cython: None
numpy: 1.16.1
scipy: 1.2.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: