[Numpy-discussion] maximmum.reduce and nans

Martin Wiechert martin.wiechert at gmx.de
Wed Jun 14 10:58:03 CDT 2006

Hi list,

does anybody know, why

maximum.reduce (())

does not return -inf?

Looks very natural to me and as a byproduct maximum.reduce would ignore nans, 
thereby removing the need of nanmax etc.

The current convention gives

>>> from numpy import *
>>> maximum.reduce ((1,nan))
>>> maximum.reduce ((nan, 1))
>>> maximum.reduce (())
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: zero-size array to ufunc.reduce without identity

Cheers, Martin

More information about the Numpy-discussion mailing list