[Numpy-discussion] Indices of min/max element of an array?
Alan G Isaac
aisaac at american.edu
Tue Dec 6 15:34:01 CST 2005
On Tue, 6 Dec 2005, Christos Siopis apparently wrote:
> 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.
SciPy arrays function as "expected" in this sense:
>>> import scipy
>>> x=scipy.array([[1,2],[3,4]])
>>> x.max()
4
>>> x.argmax()
3
Note that, as I understand, argmax gives the index from x.flat
Also, the scipy ufuncs max and argmax have the symmetry you
seek, if I understand correctly.
hth,
Alan Isaac
More information about the Numpy-discussion
mailing list