[Numpy-discussion] Index update

Mads Ipsen madsipsen@gmail....
Tue Jan 10 14:14:02 CST 2012


Hi,

Suppose you have N items, say N = 10.

Now a subset of these items are selected given by a list A of indices. 
Lets say that items A = [2,5,7] are selected. Assume now that you delete 
some of the items given by the indices S = [1,4,8]. This means that the 
list of indices A must be updated, since items have been deleted. For 
this particular case the updated selection list A becomes A = [1,3,5].

Is there some smart numpy way of doing this index update of the selected 
items in A without looping? Typically N is large.

Best regards,

Mads

-- 
+-----------------------------------------------------+
| Mads Ipsen                                          |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen@gmail.com |
+----------------------+------------------------------+


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120110/90877fe9/attachment.html 


More information about the NumPy-Discussion mailing list