Skip to content

BUG: .replace does not support None as a target value #45490

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
2 of 3 tasks
jmg-duarte opened this issue Jan 20, 2022 · 3 comments
Closed
2 of 3 tasks

BUG: .replace does not support None as a target value #45490

jmg-duarte opened this issue Jan 20, 2022 · 3 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@jmg-duarte
Copy link
Contributor

jmg-duarte commented Jan 20, 2022

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

pd.DataFrame({'a': [pd.NA]}).replace(pd.NA, None)

Issue Description

The replace function uses None instead of a sentinel value to check for a missing argument, thus it does not allow None to be used.

The fillna function also has this problem.

Expected Behavior

The replace function should allow the usage of None as a target value.

Installed Versions

INSTALLED VERSIONS

commit : 66e3805
python : 3.8.10.final.0
python-bits : 64
OS : Darwin
OS-release : 20.6.0
Version : Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 1.3.5
numpy : 1.18.5
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 59.8.0
Cython : 0.29.26
pytest : 6.2.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
sqlalchemy : 1.4.30
tables : None
tabulate : None
xarray : 0.20.2
xlrd : None
xlwt : None
numba : 0.49.1

@jmg-duarte jmg-duarte added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 20, 2022
@jreback
Copy link
Contributor

jreback commented Jan 20, 2022

this is changed in 1.4.0rc0
pls check

@jmg-duarte
Copy link
Contributor Author

jmg-duarte commented Jan 20, 2022

It works for .replace but not for .fillna should I rename the issue instead of opening a new one?

Any idea when 1.4.0 will be released?

@jreback
Copy link
Contributor

jreback commented Jan 20, 2022

shortly

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