[Numpy-discussion] Clarifications in numpy.ma module
ben.root at ou.edu
Tue Dec 30 14:49:11 EST 2014
Where does it say that operations on masked arrays should not produce NaNs?
Operations on masked arrays should ignore masked data. If I have NaNs in my
masked array, but are not masked out for some reason, I expect it to give
me NaNs. The mask is not the same as NaNs. Having np.mean() return the
same thing as np.ma.mean() makes complete sense. Now, the fun comes with
the whole controversy over np.nanmean() and np.nanmean([np.nan])...
As for the rest of your points in your original post, I do not have the
knowledge to know whether or not they are actual issues, but they do look
like something that should be address in some form.
On Tue, Dec 30, 2014 at 2:39 PM, Alexander Belopolsky <ndarray at mac.com>
> On Tue, Dec 30, 2014 at 1:45 PM, Benjamin Root <ben.root at ou.edu> wrote:
>> What do you mean that the mean function doesn't take care of the case
>> where the array is empty? In the example you provided, they both end up
>> being NaN, which is exactly correct.
> Operations on masked arrays should not produce NaNs. They should produce
> ma.masked. For example,
> >>> np.ma.array(0)/0
> The fact that the user sees runtime warnings also suggests that the edge
> case was not thought out.
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion