-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Cannot replace NaNs with None #42888
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
Confirmed we see this same issue on |
xref #42423 |
I think including this info in the migration guide would be a big help. |
What do you mean by migration guide @dylancaponi? There was a note in the 1.3 whatsnew (but it's small and probably wouldn't be noticed unless read carefully). I'm not sure how amending an existing whatsnew works, but given the large number of users who seem to rely on this functionality, devoting a section to this showing new vs old behavior sounds helpful. |
Yes, maybe a "breaking changes and suggested workarounds" section. @mzeitlin11 I just skimmed the whatsnew again and don't see where this change is mentioned. Can you point me to it? |
What's the best way around this for now? I tried to revert to
|
It's in the |
The other issue has a good workaround: #42423 (comment) |
closing as duplicate of #42423 |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Previously, we were able to replace NaN values with
None
for easier insertion into databases like mysql, as listed here:https://stackoverflow.com/questions/14162723/replacing-pandas-or-numpy-nan-with-a-none-to-use-with-mysqldb
python
Output of df:
Problem description
Previously, all np.NaN were replaced with
None
. Now, they still remain asnp.NaN
, and breaks database insertionsExpected Output
Output of
pd.show_versions()
pandas : 1.3.1
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.4
setuptools : 50.3.1
Cython : 0.29.21
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.5 (dt dec pq3 ext lo64)
jinja2 : None
IPython : 7.19.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.1
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: