You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see the same issue using the dict form of replace. phonetic.replace({"x": "unknown"}, pd.NA).
richierocks
changed the title
BUG: Replacing cateogorical values with NA raises "boolean value of NA is ambiguous" error
BUG: Replacing categorical values with NA raises "boolean value of NA is ambiguous" error
Apr 27, 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
Issue Description
When replacing values in a categorical series with
NA
, I see the error "boolean value of NA is ambiguous".Expected Behavior
If we replace with NumPy's NaN value instead of pandas' NA, it works as expected.
Installed Versions
INSTALLED VERSIONS
commit : 4bfe3d0
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.176-91.338.amzn2.x86_64
Version : #1 SMP Fri Feb 4 16:59:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.2
numpy : 1.22.3
pytz : 2022.1
dateutil : 2.8.2
pip : 21.3.1
setuptools : 57.0.0
Cython : 0.29.28
pytest : 6.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : None
pymysql : 1.0.2
psycopg2 : 2.9.1
jinja2 : 3.0.1
IPython : 7.26.0
pandas_datareader: 0.10.0
bs4 : 4.9.3
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : 2.0.1
matplotlib : 3.3.4
numba : None
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : 5.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.5.4
snappy : None
sqlalchemy : 1.3.23
tables : 3.7.0
tabulate : 0.8.9
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: