-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG/DEPR: logical operation with bool and string #61995
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
Conversation
Thanks @jbrockmendel |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
f"'{op_name}' operations between boolean dtype and {self.dtype} are " | ||
"deprecated and will raise in a future version. Explicitly " | ||
"cast the strings to a boolean dtype before operating instead.", | ||
FutureWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FutureWarning, | |
DeprecationWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this!
@@ -25,7 +25,7 @@ Bug fixes | |||
- Fix :meth:`~DataFrame.to_json` with ``orient="table"`` to correctly use the | |||
"string" type in the JSON Table Schema for :class:`StringDtype` columns | |||
(:issue:`61889`) | |||
|
|||
- Boolean operations (``|``, ``&``, ``^``) with bool-dtype objects on the left and :class:`StringDtype` objects on the right now cast the string to bool, with a deprecation warning (:issue:`60234`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR might have fixed both, but I don't think this is specific to bool dtype being on the left and string on the right? Both orders of operation fails right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old behavior that we are trying to match (with object dtype) does depend specifically on the ndarray[bool] being on the left
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was only testing with string dtype to check that both were failing. You're right that for object this only worked in that order. Ignore me!
|
||
msg = "operations between boolean dtype and" | ||
with tm.assert_produces_warning(warn, match=msg): | ||
result = left | right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the other comment, would also test right | left
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.