[Numpy-discussion] argmin & min on ndarrays
Tue Mar 4 18:21:14 CST 2008
On 04/03/2008, Pierre GM <firstname.lastname@example.org> wrote:
> Thanks a lot for your suggestion. Something like
> >>>if axis is None:
> >>> return b.flat[a.argmin()]
> >>> 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 !
Ah! "It ain't the things you don't know that'll get you, it's the
things you know that ain't so." I thought rollaxis rolled the axes
around cyclically. This is much more useful, but what a funny name for
what it actually does...
I should have provided the link before, but this is very useful for
answering this kind of question:
More information about the Numpy-discussion