Thursday, January 9, 2025
Google search engine
HomeLanguagesPython | Numpy matrix.argmin()

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
neveropen = gfg.argmin()
     
print(neveropen)


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
neveropen = gfg.argmin()
     
print(neveropen)


Output:

4

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments