[Numpy-discussion] maximum value and corresponding index
Wed Aug 5 14:59:44 CDT 2009
On Wed, Aug 5, 2009 at 14:57, Dr. Phillip M.
> 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]
"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