Before posting this question, I have searched to find a solution on this website but cannot find any solution.
Suppose that I have 2 numpy 2D arrays, a
and b
, such that:
a = np.array([[0. , 1.],
[0.5, 1.6],
[1.2, 3.2],
[4. , 3. ],
[4.7, 3.5],
[5.9, 2.4],
[7.6, 8.8],
[9.5, 6.2]
])
b = np.array([[7.6, 8.8],
[4. , 3. ],
[9.5, 6.2],
[1.2, 3.2]
])
I want to get the arguments of the array b
in the array a
. That is, for each row of b
return its location on b
.
In this case, the expected result is something like:
args =np.array([6, 3, 7, 2])
I've tried with something like:
args = np.argwhere(a == b) # But the result is an empty array
Any help is appreciated.