[Numpy-tickets] [NumPy] #241: maximum and nan / identity for maximum
NumPy
numpy-tickets at scipy.net
Fri Aug 11 09:32:56 CDT 2006
#241: maximum and nan / identity for maximum
-----------------------------+----------------------------------------------
Reporter: martin_wiechert | Owner: somebody
Type: enhancement | Status: new
Priority: normal | Milestone: 1.0 Release
Component: numpy.core | Version: devel
Severity: normal | Keywords:
-----------------------------+----------------------------------------------
How should maximum handle nans? I think there are only two reasonable
behaviours. Either nans should be ignored or the result should be nan.
(I personally favour a keyword switch over a separate function nanmax.)
In the current implementation the outcome depends on the ''order'' of
elements:
{{{
>>> import numpy
>>> numpy.version.version
'1.0b1'
>>> from numpy import *
>>> a = array ((1, nan))
>>> maximum.reduce (a)
1.0
>>> maximum.reduce (a [::-1])
nan
}}}
This is certainly confusing if not a bug.
As a related request I'd like to see an identity element for maximum,
namely -inf.
All the above of course also holds for minimum.
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/241>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list