I am trying to get a slice (for example elements 1-3 and 5-N) of an array A(N,3) avoiding using numpy.delete. And example of the process will be the following:
[[1,2,3],[4,5,6],[7,8,9],[3,2,1]] ==> [[1,2,3],[3,2,1]]
I was hoping to use something like
A[A != [1,2,3] ].reshape()
But that performs an element-wise comparison and thus removes more elements than I wanted to. How does one do it? I came up with this idea but seems too complex and slow:
A_removed = A[first_removed:last:removed,:]
mask = np.not_equal(A[:,None],A_removed)
mask = np.logical_and.reduce(mask,1)
A = A[mask].reshape()
Is there a way of doing it in a faster/cleaner way?
PD the asumption that any two elements of A can't be equal always holds