-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Array-MaskedArray inplace ufunc interactions can turn out nonsensical results #9394
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
Part of the problem here is that you're discarding the mask information by forcing the result into a standard array. Your code is equivalent in result to |
Fair enough. This should be documented down somewhere tho |
This is a problem faced by in-place operations more generally, that there exists no |
This problem came up in scipy sparse as a result of a Edit: that was #9019. |
Ah, so that was for a change in behaviour of |
But this already did the right thing for |
The way |
What is seen:
While this is somewhat logical, this starts to make less sense when you come to something like this:
Here we see that the equivalent operation is
incr[1] += x[1]
.Combined with the above case with addition, we can rapidly come to a conclusion that it's essentially doing this:
incr[idx_with_invalid] += x[idx_with_invalid] <OP> identity
. I'm not sure if that's the correct thing to do.The documentation on the website is unclear on this either, stating only:
So, the question is what would the correct interpretation be with these sorts of interactions? If it's supposed to be the identity of the operation then it should be noted in the docs
The text was updated successfully, but these errors were encountered: