I have a NumPy array, and I want to retrieve all the elements except a certain index. For example, consider the following array
a = [0,1,2,3,4,5,5,6,7,8,9] <
Another solution is to use the concatenate function of NumPy:
>>> x = np.arange(0,10) array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> i = 3 >>> np.concatenate((x[:i],x[(i+1):])) array([0, 1, 2, 4, 5, 6, 7, 8, 9])