-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: fix bool no-op replace calls #6339
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
values = np.array(values_to_mask) | ||
cant_cast = not np.can_cast(values.dtype, arr.dtype, casting='safe') | ||
|
||
if cant_cast and arr.dtype == np.bool_: |
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.
if this is true, then isn't the result a noop? (regardless if its a bool or not?)
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.
no. the values_to_mask
must not be castable specifically to bool and arr.dtype
must be be bool, that's what the arr.dtype == np.bool_
is there for.
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.
and you don't want to have a BoolBlock
handler instead of this?
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.
actually yes you're right ... don't know why i didn't of this before but i can just override putmask in boolblock and check for the new
dtype there
@jreback look okay to u? |
why does this work? |
For the same reason I mentioned in #6332. |
If there's no test I'll add one |
One thing that won't work as "expected" is |
merge away neat trick with atleast1 d |
BUG: fix bool no-op replace calls
closes #6332