I have 2 numpy arrays: points = np.array([[253, 1472], [301 1956], [796, 1011], [3, 2179], [759, 844], [485, 1053], [312, 1536], [485, 1505], [313, 1304], [357, 1434]])
and coords
which basically contains all of the coordinates from [0, 0]
to [2000, 2000]
. I want to return indices of the coords
array which contain exactly the values from points
. I tried the solution from here: check for identical rows in different numpy arrays, so using this function: res = (coords[:, None] == points).all(-1).any(-1)
. However in this case this does not match the value [485, 1505]
. I suppose it is because there is another value with the same x coordinate. This is suprising for me that there is no ready numpy function for exactly that purpose. I tried everything but I don't achieve the wanted result.
Asked
Active
Viewed 31 times
0

Kuba Głowacz
- 49
- 1
- 6