Skip to content

BUG: cannot replace np.NaN with None any more #50118

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
3 tasks done
sorenwacker opened this issue Dec 7, 2022 · 2 comments
Closed
3 tasks done

BUG: cannot replace np.NaN with None any more #50118

sorenwacker opened this issue Dec 7, 2022 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@sorenwacker
Copy link

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

import pandas as pd
import numpy as np

pd.DataFrame({'A': [np.NaN]}).replace(np.NaN, None)
> RecursionError: maximum recursion depth exceeded while calling a Python object

Issue Description

This was working in an earlier versoin of pandas, but not in 1.5.1 any more.

Expected Behavior

The np.NaNs should be replaced with None in the current dataframe.

Installed Versions

INSTALLED VERSIONS

commit : 91111fd
python : 3.9.15.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-135-generic
Version : #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.1
numpy : 1.21.5
pytz : 2022.1
dateutil : 2.8.2
setuptools : 65.5.0
pip : 22.2.2
Cython : None
pytest : 6.2.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.2
lxml.etree : 4.6.4
html5lib : None
pymysql : None
psycopg2 : 2.9.5
jinja2 : 3.0.3
IPython : 8.6.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : 1.3.5
brotli :
fastparquet : 0.7.1
fsspec : 2021.11.0
gcsfs : None
matplotlib : 3.6.1
numba : 0.55.1
numexpr : 2.8.3
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 6.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.6.2
snappy : None
sqlalchemy : 1.4.27
tables : 3.6.1
tabulate : 0.8.9
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : None
tzdata : None

@sorenwacker sorenwacker added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 7, 2022
@mroeschke
Copy link
Member

I believe this is fixed if you install 1.5.2 https://pandas.pydata.org/docs/dev/whatsnew/v1.5.2.html

@sorenwacker
Copy link
Author

Confirmed. For some reason my conda update pandas did not update pandas accordingly.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants