How can I find those row indices of numpy array a
that are not already in ref
?
For instance for this example:
ref = np.asarray([[1.1, 2.2, 3.3], [4, 5, 6]])
a = np.asarray([[0, 1, 2], [1.1, 2.2, 3.3], [4, 5, 5]])
A result of [0, 2]
would be correct, because these rows in a
are not in ref
. A possible solution would be to iterate over each row in a
and check if it's in ref
, but I was hoping there's a more efficient and elegant (1-liner?) way.
Note: This answer doesn't work because it is assuming integer elements of the array (in my case I use floating point numbers).