[Numpy-discussion] Re: using NaN, INT_MIN etc in ndarray instead of a masked array

Robert Kern robert.kern at gmail.com
Mon Apr 17 19:53:01 EDT 2006


Michael Sorich wrote:
> On 4/8/06, *Sasha* <ndarray at mac.com <mailto:ndarray at mac.com>> wrote:
> 
>     ...
> 
>     See above. For ndarray mask is always False unless an add-on module is
>     loaded that redefines arithmetic to recognize special bit-patterns
>     such as NaN or INT_MIN.
> 
> Is it possible to implement masked values using these special bit
> patterns in the ndarray instead of using a separate MA class? If so has
> there been any thought as to whether this may be the better option. I
> think it would be preferable if the ability to handle masked data was
> available in the standard array class (ndarray), as this would increase
> the likelihood that functions built for numeric arrays will handle
> masked values well. It seems that ndarray already has decent support for
> nans (isnan() returns the equivalent of a boolean mask array),
> indicating that such an approach may be acceptable. How difficult is it
> to generalise the concept to other data types (int, string, bool)?

Well, I'm certainly dead set against any change that would make all arrays that
happen to contain those special values to be treated as masked arrays.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the NumPy-Discussion mailing list