[NumPy-Tickets] [NumPy] #1429: inconsistent behavior of argmin/argmax with nan
NumPy Trac
numpy-tickets@scipy....
Mon Mar 15 17:23:34 CDT 2010
#1429: inconsistent behavior of argmin/argmax with nan
-------------------------------+--------------------------------------------
Reporter: jgregoire | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version: 1.3.0
Keywords: argmin argmax nan |
-------------------------------+--------------------------------------------
This is related to Ticket #1035 but I believe is an unreported issue.
When the array contains nan, argmin and argmax ignore the nan. The problem
is that if the zeroth element of the array is nan then argmin and argmax
return 0. Having the behavior of a function depend on the value of the
zeroth element is very undesirable.
In [1]: import numpy as np
In [2]: a=np.array([1., 2., 0., np.nan])
In [3]: print np.argmin(a), np.argmax(a)
------> print(np.argmin(a), np.argmax(a))
(2, 1)
In [4]: print np.argmin(a[::-1]), np.argmax(a[::-1])
------> print(np.argmin(a[::-1]), np.argmax(a[::-1]))
(0, 0)
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1429>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list