Re: [Numpy-discussion] maximum value and corresponding index

2009-08-06 Thread Hans Meine
On Thursday 06 August 2009 17:27:51 Robert Kern wrote: > 2009/8/6 Hans Meine : > > On Wednesday 05 August 2009 22:06:03 David Goldsmith wrote: > >> But you can "cheat" and put them on one line (if that's all you're after): > >> >>> x = np.array([1, 2, 3]) > >> >>> maxi = x.argmax(); maxv = x[maxi]

Re: [Numpy-discussion] maximum value and corresponding index

2009-08-06 Thread Robert Kern
2009/8/6 Hans Meine : > On Wednesday 05 August 2009 22:06:03 David Goldsmith wrote: >> But you can "cheat" and put them on one line (if that's all you're after): >> >>> x = np.array([1, 2, 3]) >> >>> maxi = x.argmax(); maxv = x[maxi] > > Is there any reason not to put this as a convenience function

Re: [Numpy-discussion] maximum value and corresponding index

2009-08-06 Thread Hans Meine
On Wednesday 05 August 2009 22:06:03 David Goldsmith wrote: > But you can "cheat" and put them on one line (if that's all you're after): > >>> x = np.array([1, 2, 3]) > >>> maxi = x.argmax(); maxv = x[maxi] Is there any reason not to put this as a convenience function into numpy? It is needed so f

Re: [Numpy-discussion] maximum value and corresponding index

2009-08-05 Thread David Goldsmith
But you can "cheat" and put them on one line (if that's all you're after): >>> x = np.array([1, 2, 3]) >>> maxi = x.argmax(); maxv = x[maxi] >>> maxi, maxv (2, 3) DG --- On Wed, 8/5/09, Robert Kern wrote: > From: Robert Kern > Subject: R

Re: [Numpy-discussion] maximum value and corresponding index

2009-08-05 Thread Robert Kern
On Wed, Aug 5, 2009 at 14:57, Dr. Phillip M. Feldman wrote: > > With Python/NumPy, is there a way to get the maximum element of an array and > also the index of the element having that value, at a single shot? Not in one shot. maxi = x.argmax() maxv = x[maxi] -- Robert Kern "I have come to bel

[Numpy-discussion] maximum value and corresponding index

2009-08-05 Thread Dr. Phillip M. Feldman
With Python/NumPy, is there a way to get the maximum element of an array and also the index of the element having that value, at a single shot? (One can do this in Matlab via a statement like the following: [x_max,ndx]= max(x) -- View this message in context: http://www.nabble.com/maximum-valu