[Numpy-discussion] numpy.nansum() behavior in 1.3.0

josef.pktd@gmai... josef.pktd@gmai...
Mon Jun 1 15:31:52 CDT 2009


On Mon, Jun 1, 2009 at 4:06 PM, Alan G Isaac <aisaac@american.edu> wrote:
> On 6/1/2009 3:38 PM josef.pktd@gmail.com apparently wrote:
>> Here's a good one:
>>
>>>>> np.isnan([]).all()
>> True
>>>>> np.isnan([]).any()
>> False
>
>
>  >>> all([])
> True
>  >>> any([])
> False

also:

>>> y
array([], dtype=float64)
>>> (y>0).all()
True
>>> (y>0).any()
False
>>> ((y>0)>0).sum()
0

I don't know what's the logic, but it causes the bug in np.nansum.
Josef


More information about the Numpy-discussion mailing list