[Numpy-discussion] New functions.

Robert Kern robert.kern@gmail....
Wed Jun 1 12:36:30 CDT 2011


On Wed, Jun 1, 2011 at 12:30, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> On 5/31/11 6:08 PM, Charles R Harris wrote:
>> 2) Ufunc fadd (nanadd?) Treats nan as zero in addition.
>
> so:
>
> In [53]: a
> Out[53]: array([  1.,   2.,  nan])
>
> In [54]: b
> Out[54]: array([0, 1, 2])
>
> In [55]: a + b
> Out[55]: array([  1.,   3.,  nan])
>
> and nanadd(a,b) would yield:
>
> array([  1.,   3.,  2.)
>
> I don't see how that is particularly useful, at least not any more
> useful that nanprod, nandiv, etc, etc...
>
> What am I missing?

It's mostly useful for its .reduce() and .accumulate() form.

-- 
Robert Kern

"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