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

Keith Goodman kwgoodman at gmail.com
Mon Jun 1 13:43:19 EDT 2009


On Mon, Jun 1, 2009 at 9:55 AM, Michael Hearne <mhearne at usgs.gov> wrote:
> A question (and possibly a bug):
>
> What should be returned when I do:
>
> numpy.nansum([])
>
> In my copy of numpy 1.1.1, I get 0.0.  This is what I would expect to
> see.
> However, this behavior seems to have changed in 1.3.0, in which I get
> nan.

Here's a weird one. This is in numpy 1.2:

>> np.sum(9)
   9
>> np.sum(9.0)
   9.0
>> np.nansum(9)
   9
>> np.nansum(9.0)
---------------------------------------------------------------------------
IndexError: 0-d arrays can't be indexed.



More information about the NumPy-Discussion mailing list