How can I know the (row, column) index of the minimum of a numpy array/matrix?
For example, if A = array([[1, 2], [3, 0]]), I want to get (1, 1)
A = array([[1, 2], [3, 0]])
(1, 1)
Thanks!
Use unravel_index:
unravel_index
numpy.unravel_index(A.argmin(), A.shape)
1.4m articles
1.4m replys
5 comments
57.0k users