[Numpy-discussion] consensus (was: NA masks in the next numpy release?)

Han Genuit hangenuit@gmail....
Sat Oct 29 18:13:18 CDT 2011


On Sun, Oct 30, 2011 at 12:47 AM, Eric Firing <efiring@hawaii.edu> wrote:
> On 10/29/2011 12:02 PM, Olivier Delalleau wrote:
>
>>
>> I haven't been following the discussion closely, but wouldn't it be instead:
>> a.mask[0:2] = True?
>
> That would be consistent with numpy.ma and the opposite of Mark's
> implementation.
>
> I can live with either, but I much prefer the numpy.ma version because
> it fits with the use of bit-flags for editing data; set bit 1 if it
> fails check A, set bit 2 if it fails check B, etc.  So, if it evaluates
> as True, there is a problem, and the value is masked *out*.
>

I think in Mark's implementation it works the same:

>>> a = np.arange(3, maskna=True)
>>> a[1] = np.NA
>>> a
array([0, NA, 2])
>>> np.isna(a)
array([False,  True, False], dtype=bool)

This is more consistent than using False to represent an NA mask, I agree.


More information about the NumPy-Discussion mailing list