I'm trying to delete some elements from array this way:
a = [2, 5, 10, 20, 30, 40]
for i in range(len(a)):
print(a[i], i)
if (a[i] > 20):
a = np.delete(a, i)
print(a)
And I catch an error: index 5 is out of bounds for axis 0 with size 5. I don't really understand what's wrong with the code above. Could somebody, please, explain the problem?
aas it changes in the loop? You printa[i]but nota.