[Numpy-discussion] What should be the value of nansum of nan's?

Keith Goodman kwgoodman@gmail....
Thu Apr 29 19:00:52 CDT 2010

On Thu, Apr 29, 2010 at 9:56 AM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
> It looks like the consensus is that zero should be returned. This is a
> change from current behaviour and that bothers me a bit. Here are some other
> oddities
> In [6]: nanmax([nan])
> Out[6]: nan
> In [7]: nanargmax([nan])
> Out[7]: nan
> In [8]: nanargmax([1])
> Out[8]: 0
> So it looks like the current behaviour is very much tilted towards nans as
> missing data flags. I think we should just leave that as is with perhaps a
> note in the docs to that effect. The decision here should probably
> accommodate the current users of these functions, of which I am not one.

That works well for me.

> If
> we leave the current behaviour as is then I think the rest of the nan
> functions need fixes to return nan for empty sequences as nansum is the only
> one that currently does that.

More information about the NumPy-Discussion mailing list