[Numpy-discussion] [numpy] argmin in multidimensional arrays

Robert Kern robert.kern@gmail....
Sat Mar 3 15:09:35 CST 2007


Glen W. Mabey wrote:
> Does anyone else find this behavior counter-intuitive?  
> 
> It seems to me that one of the great design features of numpy is the
> n-dim generality it provides, and argmin is one function in this breaks
> down, IMHO.

Not at all. It consistently applies the simple rule: if the method operates over
an axis, it takes an axis= keyword argument. The default for the axis= argument
is None, which means that it operates over the flattened array. Other axes need
to be specified explicitly.

See .sum(), .mean(), .var(), .repeat(), .min(), etc.

-- 
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