[SciPy-User] numpy.nansum bug?

Benjamin Root ben.root@ou....
Tue Sep 21 20:41:05 CDT 2010


On Tue, Sep 21, 2010 at 4:49 PM, Jeremy Sanders <jeremy@jeremysanders.net>wrote:

> I've hit this problem with numpy (1.3.0 on x86-64).
>
> In [12]: a = numpy.array([numpy.nan])
>
> In [13]: numpy.nansum(a)
> Out[13]: nan
>
> I assume that this is a bug? It's pretty nasty if you assume that nansum
> always returns a non nan.
>
> This is also pretty weird:
> In [14]: numpy.nansum([])
> Out[14]: nan
>
> Jeremy
>
>
>
I am not certain if this is a bug or not, but I would like to point out the
documentation:

"Return the sum of array elements over a given axis treating Not a Numbers
(NaNs) as zero."

So, either there is a bug, or the documentation needs to be clearer.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100921/9b431e92/attachment.html 


More information about the SciPy-User mailing list