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

BUG: pd.DataFrame.replace integer/float value to pd.NA causes RecursionError #50758

Closed
3 tasks done
chAngeZhaoZhanBo opened this issue Jan 15, 2023 · 0 comments · Fixed by #50760
Closed
3 tasks done
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate replace replace method

Comments

@chAngeZhaoZhanBo
Copy link

chAngeZhaoZhanBo commented Jan 15, 2023

Pandas version checks

Reproducible Example

import pandas as pd

pd.DataFrame([0, 1]).replace(0, pd.NA)
pd.DataFrame([0.5, 1.5]).replace(0.5, pd.NA)

Issue Description

pd.DataFrame.replace integer/float value to pd.NA causes RecursionError

I know this issue was reported in #49439, but it was mistakenly judged as duplication of #45725

However, #45725 only fixed the case that Dataframe replaces np.nan to pd.NA. In pandas 1.5.2, replacing integer/float value to pd.NA still crushes python kernel

Expected Behavior

      0
0    <NA>
1     1

      0
0    <NA>
1     1.5

Installed Versions

INSTALLED VERSIONS

commit : 8dab54d
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.16.3-microsoft-standard-WSL2
Version : #1 SMP Fri Apr 2 22:23:49 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.2
numpy : 1.24.1
pytz : 2022.7
dateutil : 2.8.2
setuptools : 45.2.0
pip : 20.0.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@chAngeZhaoZhanBo chAngeZhaoZhanBo added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 15, 2023
@phofl phofl added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate replace replace method and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate replace replace method
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants