I am confused with the numpy.where and numpy.argwhere. For example,
aa = (np.arange(10) + 5).reshape(2, -1)
If I run
res = np.where(((aa == 7) | (aa == 8)))
Then
>>> res
(array([0, 0]), array([2, 3]))
If I run
res2 = np.argwhere(((aa == 7) | (aa == 8)))
I get
>>> res2
array([[0, 2],
[0, 3]])
Both numpy.where and numpy.argwhere give the coordinates of the nonzero elements in the boolean array. So if the inputs are boolean arrays, the two functions are basically doing the same thing. Is it correct?