Answer by user2505961 for Filter rows in numpy array based on second array
This is certainly not the most performant solution but it is relatively easy to read:A = np.array([row for row in A if row not in B])Edit:I found that the code does not correctly work, but this does:A...
View ArticleAnswer by Mad Physicist for Filter rows in numpy array based on second array
Probably not the most performant solution, but does exactly what you want. You can change the dtype of A and B to be a unit consisting of one row. You need to ensure that the arrays are contiguous...
View ArticleAnswer by peru_45 for Filter rows in numpy array based on second array
Try the following - it uses matrix multiplication for dimensionality reduction:import numpy as npA = np.array([[3, 0, 4], [3, 1, 1], [0, 5, 9]])B = np.array([[1, 1, 1], [3, 1, 1]])arr_max =...
View ArticleFilter rows in numpy array based on second array
I have 2 2d numpy arrays A and BI want to remove all the rows in A which appear in B.I tried something like this:A[~np.isin(A, B)]but isin keeps the dimensions of A, I need one boolean value per row to...
View Article
More Pages to Explore .....