deleting certain entries in numpy array
sebastian.schabe at gmx.de
Thu Jul 2 05:40:12 EDT 2009
Robert Kern schrieb:
> First, convert the pos array to integers, and just the columns with
> indices in them:
> ipos = pos[:,:2].astype(int)
> Now check the values in the mask corresponding to these positions:
> mask_values = mask[ipos[:,0], ipos[:,1]]
> Now extract the rows from the original pos array where mask_values is
> result = pos[mask_values != 0]
Great!!! That's the way I wanted.
After reading the numpy reference guide I supposed the delete function
was not the right way, but that it's all about cerrect indexing. But I
didn't really know how.
So thanks a lot, also to Ben.
> You will want to ask numpy questions on the numpy mailing list.
I ever thought news-groups are the right way for questions like this.
And the mailing list page just confuses me, but I'm trying to get used
More information about the Python-list