I'm trying to find all the minimum values in an array and retrieve their indices.
import numpy as np
a = np.array([[1,2],[1,4]])
minE = np.min(a)
ax,ay = np.unravel_index(minE, a.shape)
only returns minE = 1
, ax, ay = 0 1
Can anyone help me out in a way that would also provide indices for all equal value minima (here, indices for both 1's)?
Were you looking for this:
x = np.array([[1,2,3],[1,4,2]])
np.where(x == np.amin(x))