[Numpy-discussion] (no subject)

Robert Kern robert.kern@gmail....
Wed Mar 2 16:29:27 CST 2011

On Wed, Mar 2, 2011 at 16:25, Alex Ter-Sarkissov <ater1980@gmail.com> wrote:
> hi, the question is probably very silly, but can't get my head around it
> Say I have an NxM numerical array. What I want is to obtain the row and
> column number of the smallest value(kinda like find command in Matlab). I
> use something like where(min(array_name)), but keep getting the error
> message. I'd be glad if any1 could have any suggestions in this regard.

|15> A = np.random.random([3,5])

|16> i = A.min(axis=1).argmin()

|17> j = A.min(axis=0).argmin()

|18> A[i,j]

|19> A.min()

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list