The first array ( array([2, 2, 2])) is the index of the rows, and the second ( array([0, 1, 2])) is the columns of those values that are greater than 5.
You can use zipto get the exact index of values:
>>> zip(*np.where( x > 5 ))
[(2, 0), (2, 1), (2, 2)]
Or use np.dstack:
>>> np.dstack(np.where( x > 5 ))
array([[[2, 0],
[2, 1],
[2, 2]]])
source
share