I have two 2d array, A and B, like the following.
A=array([[1, 1, 1],
[2, 2, 2],
[3, 3, 3],
[4, 4, 4],
[5, 5, 5],
[6, 6, 6],
[7, 7, 7],
[8, 8, 8],
[9, 9, 9]])
B=array([[1, 1, 1],
[3, 3, 3],
[8, 8, 8]])
I want to remove subarrays of A if they exist in B. Then return a new 2d array C like the following:
C=array([[2, 2, 2],
[4, 4, 4],
[5, 5, 5],
[6, 6, 6],
[7, 7, 7],
[9, 9, 9]])
Currently I have tried the np.isin function but the result is no longer a 2d array.
mask = np.isin(A, B, invert=True)
A[mask]
>>array([2, 2, 2, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 9, 9, 9])