I have numpy array, and I want to select a number of values based on their index number. I am using Python3.6
for example:
np.array:
index#
[0]
[1] + + + + + + + + + + + + + + + + + + + +
[2] + I want to selct + + I don't want to select:
[3] + the indexs: + + [0]
[4] + [2] + + [10]
[5] + [4] + + Or any between
[6] + [6] + +
[7] + [8] + + + + + + + + + + +
[8] + + + + + + + + + +
[9]
[10]
so as you can see for the example above I want to select the index number:
if x = 2, 4, 8
this will work if I just specify the numbers in x but if I want to make x variable I tried for example:
if x:
for i in np.arange(x+2, x-last_index_number, x+2):
return whatever
Where x+2 = the first index I want (the start point). x-last_index_number = the last index I want (the last point). x+2 = the step (I want it to go the next index number by adding 2 to x and so on. but this didn't work.
So my question can I specify numbers to select in a certain order:
[5][10][15][20][25][30][35]
or
[4][8][12][16][20]