I am trying to take an array of integers such as:
[1,2,3,4,9,10,11,12,18,19,20,21] and get the values at which there is a "jump," so, the output of my program would be [1,9,18]. I wrote the following code in Python which seems to be taking forever to run:
min_indices = np.where(data[:,1] == data[:,1].min())
start_indices = np.array([0])
i = 1
while (i < len(min_indices[0])):
if (min_indices[0][i] != (min_indices[0][i-1] + 1)):
start_indices.append(min_indices[i])
print start_indices
iin your loop, this is causing running forever.