You can use np.argwhere
to return the indices of all the entries in an array matching a boolean condition:
>>> x = np.array([[0,0.2,0.5],[0.05,0.01,0]])
>>> np.argwhere(x > 0.01)
array([[0, 1],
[0, 2],
[1, 0]])
You can use np.argwhere
to return the indices of all the entries in an array matching a boolean condition:
>>> x = np.array([[0,0.2,0.5],[0.05,0.01,0]])
>>> np.argwhere(x > 0.01)
array([[0, 1],
[0, 2],
[1, 0]])