[Numpy-discussion] missing data discussion round 2

Lluís xscript at gmx.net
Wed Jun 29 17:40:06 EDT 2011


Nathaniel Smith writes:
> I know that the part 1 of that proposal would satisfy my needs, but I
> don't know as much about your use case, so I'm curious. Would that
> proposal (in particular, part 2, the classic masked-array part) work
> for you?

I'm for the option of having a single API when you want to have NA
elements, regardless of whether it's using masks or bit patterns.

My question is whether your ufuncs should react differently depending on
the type of array you're using (bit pattern vs mask).

In the beginning I thought it could make sense, as you know how you have
created the array. So if you're using masks, you're probably going to
ignore the NAs (becase you've explicitly set them, and you don't want a
NA as the result of your summation).

*But*, the more API/semantics both approaches share, the better; so I'd
say that its better that they show the *very same* behaviour
(w.r.t. "skipna").

My concern is now about how to set the "skipna" in a "comfortable" way,
so that I don't have to set it again and again as ufunc arguments:

>>> a
array([NA, 2, 3])
>>> b
array([1, 2, NA])
>>> a + b
array([NA, 2, NA])
>>> a.flags.skipna=True
>>> b.flags.skipna=True
>>> a + b
array([1, 4, 3])


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



More information about the NumPy-Discussion mailing list