returning index of minimum in a list of lists

Bas wegwerp at
Thu Jun 22 00:02:58 CEST 2006

JJLaRocque at wrote:
> Thanks so much for your help.  I was wondering if there was anything
> even simpler, but this will be great.

>>> from numpy import *
>>> a=array([[3,3,3,3], [3,3,3,1], [3,3,3,3]])
>>> where(a==a.min())
(array([1]), array([3]))

Probably overkill for your simple problem, but this is a nice
alternative if you do a lot of matrix work.


More information about the Python-list mailing list