[Numpy-discussion] missing data discussion round 2

Eric Firing efiring@hawaii....
Thu Jun 30 14:27:24 CDT 2011

On 06/30/2011 08:53 AM, Nathaniel Smith wrote:
> On Wed, Jun 29, 2011 at 2:21 PM, Eric Firing<efiring@hawaii.edu>  wrote:
>> In addition, for new code, the full-blown masked array module may not be
>> needed.  A convenience it adds, however, is the automatic masking of
>> invalid values:
>> In [1]: np.ma.log(-1)
>> Out[1]: masked
>> I'm sure this horrifies some, but there are times and places where it is
>> a genuine convenience, and preferable to having to use a separate
>> operation to replace nan or inf with NA or whatever it ends up being.
> Err, but what would this even get you? NA, NaN, and Inf basically all
> behave the same WRT floating point operations anyway, i.e., they all
> propagate?

Not exactly. First, it depends on np.seterr; second, calculations on NaN 
can be very slow, so are better avoided entirely; third, if an array is 
passed to extension code, it is much nicer if that code only has one NA 
value to handle, instead of having to check for all possible "bad" values.

> Is the idea that if ufunc's gain a skipna=True flag, you'd also like
> to be able to turn it into a skipna_and_nan_and_inf=True flag?

No, it is to have a situation where skipna_and_nan_and_inf would not be 
needed, because an operation generating a nan or inf would turn those 
values into NA or IGNORE or whatever right away.


> -- Nathaniel
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list