I have two numpy arrays that have overlapping rows:
import numpy as np
a = np.array([[1,2], [1,5], [3,4], [3,5], [4,1], [4,6]])
b = np.array([[1,5], [3,4], [4,6]])
You can assume that:
- the rows are sorted
- the rows within each array is unique
- array
b
is always subset of arraya
I would like to get an array that contains all rows of a
that are not in b
.
i.e.,:
[[1 2]
[3 5]
[4 1]]
Considering that a
and b
can be very, very large, what is the most efficient method for solving this problem?