I have two multidimensional arrays with the same second dimension. I want to be sure no element (i.e., no row) of the first array is also a row of the second array.
To do this I am using numpy.where
, but its behaviour is also checking for sub-elements in the same position. For example consider this code:
x = np.array([[0,1,2,3], [4,0,6,9]])
z= np.array([[0,1,2,3], [5, 11, 6,98]])
for el in x:
print(np.where(z==el))
It prints:
(array([0, 0, 0, 0]), array([0, 1, 2, 3]))
(array([1]), array([2]))
where the first result is due to the first arrays being equal, the second is because the both z[1]
and x[1]
have 6
as third element. Is there a way to tell np.where
to return only indexes of strictly equal elements, i.e. 0
in the example above?