[Numpy-discussion] maximmum.reduce and nans (original) (raw)

Martin Wiechert martin.wiechert at gmx.de
Wed Jun 14 11:58:03 EDT 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)) 1.0 maximum.reduce ((nan, 1)) nan maximum.reduce (()) Traceback (most recent call last): File "", line 1, in ? ValueError: zero-size array to ufunc.reduce without identity

Cheers, Martin



More information about the NumPy-Discussion mailing list