I am working on a python project but stuck in a place which disturbs me for hours . I really need your help!!!
Here is the question:
I got a numpy array X which is very large in size (1300000 × 110) , and I want to delete a batch of rows from the array simultaneously. The indexes of rows for deleting are stored in a python list. Let's say X is the array and lis is the list.
Is there any numpy functions can do this or some other smart tricks?
np.deletecreates amask=np.ones(nrows, bool); sets the delete values to False,mask[idx]=False, and returnsyour_array[mask,;]. In other words, it uses a boolean mask to select the rows you want to keep.