Skip to content
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

Reading nans in object column #22148

Closed
hwchase17 opened this issue Jul 31, 2018 · 1 comment · Fixed by #22207
Closed

Reading nans in object column #22148

hwchase17 opened this issue Jul 31, 2018 · 1 comment · Fixed by #22207
Labels
IO Data IO issues that don't fit into a more specific label Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@hwchase17
Copy link

Code Sample, a copy-pastable example if possible

import numpy as np

series1 = pd.Series(['hi', np.nan, 'bye'])
series1.to_pickle('tmp/mystery_series.pkl')
series2 = pd.read_pickle('tmp/mystery_series.pkl')

print(series1.isin({np.nan}))

print(series2.isin({np.nan}))

Problem description

Saving the file (via pickle in example above, but also w msgpack) and then loading it again changes the dtype of the nans slightly in series with object type so that they no longer evaluate to True when checking if in set of np.nan, whereas before they did

Still evaluate to True for series2.isnull()

Expected Output

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-39-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.3
pytest: None
pip: 10.0.1
setuptools: 40.0.0
Cython: 0.28.4
numpy: 1.14.5
scipy: 1.1.0
pyarrow: 0.9.0
xarray: None
IPython: 6.4.0
sphinx: None
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: 0.4.0
matplotlib: 2.2.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.9999999
sqlalchemy: 1.2.10
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@WillAyd
Copy link
Member

WillAyd commented Aug 1, 2018

Thanks for the report. Maybe related to #22119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants