-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Processing of .mask() for pd.NA #56844
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
Labels
Comments
Thanks for the bug report. Yea seems like mask is not properly handing pd.NA from your OP - pull requests to fix are always welcome! |
mafaldam
added a commit
to mafaldam/pandas
that referenced
this issue
Apr 2, 2024
This commit addresses an issue where using pandas.NA in conjunction with the mask() method resulted in unexpected behavior. The problem arose when comparing a Series containing pandas.NA with a condition within mask(), causing inconsistencies in the output. This fix ensures that pandas.NA behaves consistently with False in logical operations within mask().
mafaldam
added a commit
to mafaldam/pandas
that referenced
this issue
Apr 3, 2024
This commit addresses an issue where using pandas.NA in conjunction with the mask() method resulted in unexpected behavior. The problem arose when comparing a Series containing pandas.NA with a condition within mask(), causing inconsistencies in the output. This fix ensures that pandas.NA behaves consistently with False in logical operations within mask().
5 tasks
mafaldam
added a commit
to mafaldam/pandas
that referenced
this issue
May 8, 2024
This commit addresses an issue where using pandas.NA in conjunction with the mask() method resulted in unexpected behavior. The problem arose when comparing a Series containing pandas.NA with a condition within mask(), causing inconsistencies in the output. This fix ensures that pandas.NA behaves consistently with False in logical operations within mask().
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
For example, suppose you have a DataFrame like the one above.
This works as expected.
This also works as expected.
This also works as expected.
This behavior confuses a lot of people.
Feature Description
I think most people would expect this result.
I think you should either set the result of the logical operation on pd.NA to False
or change the .mask() method to make pd.NA behave the same as False.
Alternative Solutions
Using .fillna(False) will do what you expect, but I think it would be a depressing task for many people.
Additional Context
No response
The text was updated successfully, but these errors were encountered: