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.

Ben Root

On Tue, Dec 30, 2014 at 2:39 PM, Alexander Belopolsky <[email protected]>
wrote:

>
> On Tue, Dec 30, 2014 at 1:45 PM, Benjamin Root <[email protected]> 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
> masked
>
> The fact that the user sees runtime warnings also suggests that the edge
> case was not thought out.
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to