BUG: Series.replace with to_replace dict and value=None, nonsensical error message #46004
Open
2 of 3 tasks
Labels
Bug
Error Reporting
Incorrect or improved errors from pandas
replace
replace method
Series
Series data structure
Uh oh!
There was an error while loading. Please reload this page.
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
yields the error as expected:
However,
yields exactly the same error
Expected Behavior
I suspect this change occurred because we now treat
None
in the value field explicitly. However, the error message makes no sense anymore. I believe the expected behavior is that we get an error telling us that evenNone
is no longer allowed for value when using a dict into_replace
.Installed Versions
INSTALLED VERSIONS
commit : 06d2301
python : 3.10.2.final.0
python-bits : 64
OS : Darwin
OS-release : 20.6.0
Version : Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.1
numpy : 1.22.2
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 60.9.1
Cython : None
pytest : 7.0.1
hypothesis : 6.36.2
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2022.01.0
gcsfs : None
matplotlib : None
numba : None
numexpr : 2.8.0
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : 2022.01.0
scipy : None
sqlalchemy : 1.4.31
tables : 3.7.0
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: