-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: df.mask with int df throws ValueError instead of TypeError #56330
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
Comments
Thanks for the report. It seems to me the values of the string data is not the issue - there is no possible string value that won't raise. Thus, I don't think a
Rather, it's the type of the data being passed, and so |
Yep agreed, closing |
Does this mean that the code should be changed to throw a TypeError for dfs with int columns as well then? |
Confirmed on main - yes, I think these should be TypeErrors. PR to fix is welcome! |
Made a PR for this. Check it out. |
@rhshadrach which part of the code should be changed here? Could you please help? |
Is this issue still open? If yes, can I please work on it? |
@rhshadrach I wonder why is this issue still open. Didn't @DarthKitten2130 merged a PR already? |
Thanks @TahirAlauddin - confirmed #56495 closed this. |
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
This should result in a ValueError that a boolean value must be passed, but instead, it throws a TypeError for
~
being applied to strings.Expected Behavior
ValueError: Boolean array expected for the condition, not object
Installed Versions
INSTALLED VERSIONS
commit : 2a953cf
python : 3.10.13.final.0
python-bits : 64
OS : Darwin
OS-release : 23.1.0
Version : Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.3
numpy : 1.26.1
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.3
Cython : None
pytest : 7.4.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.17.2
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : 2023.10.0
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 10.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.4.50
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
Also present on pandas 1.5.3
The text was updated successfully, but these errors were encountered: