[SciPy-User] numpy.nansum bug?

josef.pktd@gmai... josef.pktd@gmai...
Tue Sep 21 20:45:29 CDT 2010


On Tue, Sep 21, 2010 at 9:41 PM, Benjamin Root <ben.root@ou.edu> wrote:
> 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.

There was a long thread earlier this year where most but not all
agreed that this is a bug.

(my opinion is on record)

Josef

> Ben Root
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


More information about the SciPy-User mailing list