[Numpy-discussion] NA masks in the next numpy release?

Benjamin Root ben.root at ou.edu
Fri Oct 28 16:14:59 EDT 2011


On Fri, Oct 28, 2011 at 3:02 PM, Matthew Brett <matthew.brett at gmail.com>wrote:

>
> You and I know that I've got an array with values [99, 100, 3] and a
> mask with values [False, False, True].  So maybe I'd like to see what
> happens if I take off the mask from the second value.   I know that's
> what I want to do, but I don't know how to do it, because you won't
> let me manipulate the mask, because I'm not allowed to know that the
> NA values come from the mask.
>
> The alterNEP is just saying - please - be straight with me.   If
> you're doing masking, show me the mask, and don't try and hide that
> there are stored values underneath.
>
>
Considering that you have admitted before to not regularly using masked
arrays, I seriously doubt that you would be able to judge whether this is a
significant detriment or not.  My entire point that I have been making is
that Mark's implementation is not the same as the current masked arrays.
Instead, it is a cleaner, more mature implementation that gets rid of
extraneous "features".  Instead of fussing around with a mask directly in
the array, the user of masked arrays should now consider the use of views as
the masks.  It works beautifully because it works off a well-documented and
well-understood feature of numpy.

Of course, when you look at the feature in your way, with those
expectations, then I would agree that it might be confusing.  But given that
this is a completely new feature, then we have the opportunity to properly
document and show how to rethink a user's pre-conceptions of masked arrays.

Users can keep the original array as a plain array and have mask1, mask2,
mask3, etc as being separate views.  It is a completely different way to
think of masked arrays, and considering that masked arrays are not widely
used in other toolkits, I think we can be free to change the paradigm.
Further, there is no reason why we can't keep numpy.ma around for backwards
compatibility and for those who "just don't get it".

Cheers,
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111028/0b5196b9/attachment.html>


More information about the NumPy-Discussion mailing list