[Numpy-discussion] Indices of min/max element of an array?
christos.siopis at ulb.ac.be
Tue Dec 6 12:29:04 CST 2005
On Tue, Dec 06, 2005 at 12:17:14PM -0500, Perry Greenfield wrote:
> Why not:
> ind = where(arr == arr.max())
> and use the first element of the index array(s)
Thanks, that worked nice! I was stuck with the old Numeric definition of where().
Could it perhaps be made more obvious in numarray's where() documentation that it
can also be called with one parameter only? (I.e., put this information in the
section header, not mid-way in the description). I'm looking at the April 20, 2005
Would it be safe to assume that the numarray definition of where() will be the one
propagated into scipy.core?
As a side note, i am wondering if there is a semantic asymmetry in using min() and
max() to signify the min/max element in the entire array while argmin() and
argmax() signify the min/max element along each axis. At the same time, and as far
as i can tell, there is no min()/max() method to provide the min/max element along
each axis, and there is no method to do the equivalent of "argmin/max_all()", as
implemented by where(arr == arr.min/max()). Apologies if this has been discussed
More information about the Numpy-discussion