-
-
Notifications
You must be signed in to change notification settings - Fork 11k
np.hist: needs to be enabled for masked arrays (Trac #1214) #1812
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
@timmie wrote on 2009-09-24 please send me changes for review. |
Milestone changed to |
@rgommers wrote on 2011-04-02 This is an enhancement request. Should not be changed in numpy.histogram, and there is no numpy.ma.histogram. |
I think this is the same issue I am seeing, but I will post some example code: arr = np.ones((10,))
arr[3] = 0
np.histogram(np.ma.masked_equal(arr, 0)) yields the 0 still being there:
whereas |
I expect |
Shouldn't there at least be a warning to the user if a masked array is passed into a function that doesn't handle the masked array and just silently uses the underlying data? |
@cancan101: that might make sense, but it's fundamentally impossible to do in a reliable way given np.ma's design. (Specifically, it uses subclassing but massively violates the Liskov substitution principle.) Unfortunately np.ma has a number of these kinds of problems that aren't really fixable, which is why many of us strongly recommend that it not be used in new code. |
Original ticket http://projects.scipy.org/numpy/ticket/1214 on 2009-09-01 by @timmie, assigned to @pierregm.
In R_project:
Note: values is my dataset
There masking the zeros has an effect.
With numpy not.
The text was updated successfully, but these errors were encountered: