I am trying to figure out how to index both "standalone" elements and ranges simultaneously in NumPy.
Suppose we have an array
arr = np.arange(0, 20)
and we want to take, say, 2nd, 4th, 6th elements and also all elements from 10th to the end of the array. What I coded to achieve that was
arr[np.hstack([2, 4, 6, np.arange(10, len(arr))])]
but this doesn't look very elegant. What I would like is something like that:
arr[[2, 4, 6, 10:]]
The code apparently doesn't work, but is there anything as simple as this?