Numpy argmax. How to calculate both max and argmax?

Is there a way to get max and argmax in one stroke?

import numpy as np a=[0,0,1,0] maximum=max(a) index=np.argmax(a) 

The fastest way to do this:

 [maximum,index]=function(a) 
+8
python numpy
source share
1 answer

Maybe something like this is faster ...

 index=np.argmax(a) max=a(index) 
+9
source share

All Articles