We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
import numpy as np import pandas as pd s = pd.Series(dtype=object) s["none"] = None s["nan"] = np.nan assert s["none"] is None # Fails s["none"] = None assert s["none"] is None # Passes
Upon initial creation of an item in a Series, None is coerced to NaN, even if dtype=object. After the item exists, it is then possible to set as None.
None
NaN
dtype=object
Expect the example above to not raise an exception.
pandas : 1.5.0 numpy : 1.23.3 pytz : 2022.1 dateutil : 2.8.2 setuptools : 65.4.1 pip : 22.2.2 Cython : None pytest : 7.1.3 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.0.3 lxml.etree : 4.9.1 html5lib : None pymysql : 1.0.2 psycopg2 : None jinja2 : 3.1.2 IPython : 8.5.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : fastparquet : 0.8.3 fsspec : 2022.8.2 gcsfs : None matplotlib : 3.6.0 numba : None numexpr : 2.8.3 odfpy : None openpyxl : 3.0.10 pandas_gbq : None pyarrow : 6.0.1 pyreadstat : None pyxlsb : None s3fs : 0.4.2 scipy : 1.8.1 snappy : None sqlalchemy : 1.4.41 tables : 3.7.0 tabulate : 0.9.0 xarray : 2022.9.0 xlrd : 2.0.1 xlwt : None zstandard : None tzdata : None
The text was updated successfully, but these errors were encountered:
Hi, thanks for your report. Duplicate of #48665
Sorry, something went wrong.
No branches or pull requests
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Upon initial creation of an item in a Series,
None
is coerced toNaN
, even ifdtype=object
. After the item exists, it is then possible to set asNone
.Expected Behavior
Expect the example above to not raise an exception.
Installed Versions
pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.1
dateutil : 2.8.2
setuptools : 65.4.1
pip : 22.2.2
Cython : None
pytest : 7.1.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.9.1
html5lib : None
pymysql : 1.0.2
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.5.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli :
fastparquet : 0.8.3
fsspec : 2022.8.2
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : 2.8.3
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.8.1
snappy : None
sqlalchemy : 1.4.41
tables : 3.7.0
tabulate : 0.9.0
xarray : 2022.9.0
xlrd : 2.0.1
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: