I want to get the rows of B where:
- If
A[:,0]is equal to eitherB[:,0]orB[:,2], thenA[:,1]has to be equal toB[:,1]orB[:,3]respectively A[:,0]is not equal to eitherB[i,0]andB[i,2]
For example:
A=np.array([[101, 1],
[103, 3]])
B=np.array([[100,1,101,1],
[100,1,102,1],
[100,1,103,3],
[100,2,101,2],
[100,2,103,2],
[101,1,100,3],
[101,1,103,2],
[101,4,100,4],
[101,4,103,4],
[104,5,102,3]])
R=np.array([[100,1,101,1],
[100,1,102,1],
[100,1,103,3],
[101,1,100,3],
[104,5,102,3]])
I tried the solution from here (Implementation of numpy in1d for 2D arrays?) but I get an error because I cannot use view with a slice of an array.
Thanks for the help!