BUG: pandas.DataFrame.where doesn't work when cond is of Pandas Dtype #36521
Labels
Bug
Duplicate Report
Duplicate issue or pull request
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The code snippet is simplified to show that when using pandas.DataFrame.where in combination with a Pandas Dtype (Int64) an AssertionError is raised.
Note that when df["input_col"] (= pandas.Series.where) or dtype="int64" (instead of "Int64") is used, the code behaves as expected.
This behaviour is broken since Pandas >= 1.1 (still an issue in 1.1.2).
Expected Output
output_col
a
b
NaN
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 2a7d332
python : 3.8.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.1.2
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 46.2.0
Cython : None
pytest : 6.0.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.3
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
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
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.19
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: