I have two arrays with different size
a = np.array([[5, 0], [2, 4], [0, 1], [3, 4], [1, 5], [5, 6], [7, 9]])
b = np.array([[0, 3], [5, 6], [2, 5], [2, 4]])
I need
c = np.array([False, True, False, False, False, True, False])
i.e. array 'b' have rows [5, 6] and [2, 4] in array 'a'. Currently, I do this by
logical = np.zeros(a.shape[0]).astype(bool)
for i in range(b.shape[0]):
logical += np.all(a == b[i], axis=1)
Is there any numpy code for doing this?