[Numpy-discussion] argmin & min on ndarrays

Pierre GM pgmdevlist@gmail....
Tue Mar 4 17:44:03 CST 2008


Anne,

Thanks a lot for your suggestion. Something like 

>>>if axis is None:
>>>    return b.flat[a.argmin()]
>>>else:
>>>   return numpy.choose(a.argmin(axis),numpy.rollaxis(b,axis,0))

seems to do the trick fairly nicely indeed. The other solutions you suggested 
would require too much ad hoc adaptation.
Thanks again !


More information about the Numpy-discussion mailing list