<div dir="ltr"><div><div>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])...<br><br></div>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.<br><br></div>Ben Root<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 2:39 PM, Alexander Belopolsky <span dir="ltr"><<a href="mailto:ndarray@mac.com" target="_blank">ndarray@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 1:45 PM, Benjamin Root <span dir="ltr"><<a href="mailto:ben.root@ou.edu" target="_blank">ben.root@ou.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">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.</blockquote></div><br></div></span><div class="gmail_extra">Operations on masked arrays should not produce NaNs.  They should produce ma.masked.  For example,</div><div class="gmail_extra"><br></div><div class="gmail_extra">>>> np.ma.array(0)/0</div><div class="gmail_extra">masked</div><div class="gmail_extra"><br></div><div class="gmail_extra">The fact that the user sees runtime warnings also suggests that the edge case was not thought out.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>