This question already has an answer here:
I have two numpy arrays that represent 2D coordinates. Each row represents (x, y)
pairs:
a = np.array([[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [5, 5]])
b = np.array([[1, 1], [5, 5], [3, 2]])
I would like to remove elements from a
which are in b
efficiently. So the result would be:
array([[2, 1], [3, 1], [3, 3]])
I can do it by looping and comparing, I was hoping I could do it easier.