Python | Numpy matrix.argmin ()



Using the Numpy matrix.argmax () method, we can find the index value of the smallest element in a given matrix that has one or more dimensions.

Syntax: matrix.argmin()

Return: Return index number of minimum elements in matrix

Example # 1:
In this example, we see that using the matrix.argmax () we can find the index of the minimum element in the given matrix.

# import important module into python

import numpy as np

 
# make a matrix with NumPy

gfg = np.matrix ( `[1, 2, 3, 4]` )

 
# using the matrix.argmin () method

geeks = gfg.argmin ()

 

print (geeks)

Exit :

 0 

Example # 2:

# import an important module into python

import numpy as np

 
# make a matrix with NumPy

gfg = < code class = "plain"> np.matrix ( `[1, 2, 3; 4, -5, 6; 7, 8, 9] ` )

  
# using the matrix.argmin () method

geeks = gfg.argmin ()

 

print (geeks)

Exit :

 4