I have two numpy-arrays:
p_a_colors=np.array([[0,0,0], [0,2,0], [119,103,82], [122,122,122], [122,122,122], [3,2,4]]) p_rem = np.array([[119,103,82], [122,122,122]]) I want to delete all the columns from p_a_colors that are in p_rem, so I get:
p_r_colors=np.array([[0,0,0], [0,2,0], [3,2,4]]) I think, something should work like
p_r_colors= np.delete(p_a_colors, np.where(np.all(p_a_colors==p_rem, axis=0)),0) but I just don't get the axis or [:] right.
I know, that
p_r_colors=copy.deepcopy(p_a_colors) for i in range(len(p_rem)): p_r_colors= np.delete(p_r_colors, np.where(np.all(p_r_colors==p_rem[i], axis=-1)),0) would work, but I am trying to avoid (python)loops, because I also want the performance right.