Python | Numpy matrix.argmax()
With the help of Numpy matrix.argmax()
method, we are able to find the index value of the maximum element in the given matrix having one or more dimension.
Syntax : matrix.argmax()
Return : Return index number of maximum element in matrix
Example #1 :
In this example we can see that with the help of matrix.argmax()
method we are able to find the index of maximum element in a given matrix.
import numpy as np
gfg = np.matrix( '[1, 2, 3, 4]' )
geeks = gfg.argmax()
print (geeks)
|
Example #2 :
import numpy as np
gfg = np.matrix( '[1, 2, 3; 4, 5, 6; 7, 8, 9]' )
geeks = gfg.argmax()
print (geeks)
|
Last Updated :
10 Apr, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...