I want to do something similar to what was asked here NumPy array, change the values that are NOT in a list of indices, but not quite the same.
Consider a nump
nump
You could use the enumerate function, excluding the indexes:
[x for i, x in enumerate(a) if i not in [1, 2, 5] ]
including them:
[x for i, x in enumerate(a) if i in [1, 2, 5]]