If you can use numpy , you can remove multiple indexes:
>>> import numpy as np >>> a = np.arange(10) >>> np.delete(a,(1,3,5)) array([0, 2, 4, 6, 7, 8, 9])
and if you use np.r_ , you can combine slices with separate indices:
>>> np.delete(a,(np.r_[0:5,7,9])) array([5, 6, 8])
However, removal is not in place , so you need to assign it to it.
fraxel Jul 03 '12 at 9:22 2012-07-03 09:22
source share