Python | Numpy matrix.argmin()

With the help of Numpy matrix.argmax() method, we are able to find the index value of the minimum element in the given matrix having one or more dimension.
Syntax :
matrix.argmin()Return : Return index number of minimum elements 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 minimum element in a given matrix.
# import the important module in python import numpy as np # make a matrix with numpy gfg = np.matrix('[1, 2, 3, 4]') # applying matrix.argmin() method zambiatek = gfg.argmin() print(zambiatek) |
Output:
0
Example #2 :
# import the important module in python import numpy as np # make a matrix with numpy gfg = np.matrix('[1, 2, 3; 4, -5, 6; 7, 8, 9]') # applying matrix.argmin() method zambiatek = gfg.argmin() print(zambiatek) |
Output:
4



