I want to find multiple matching rows from 2d array a
a = np.array([[2, 1], [3, 3], [4, 6], [4, 8], [4, 7], [4, 3]]) I have to search following entries
b = np.array([[4,6], [4,7]]) I know that I can loop over b and do following
for i in range(len(b)) : print(np.where(np.all(a==b[i],axis=1))[0]) And I get following
[2] [4] Can I get [[2],[4]] directly without using any loop?