[Solved] extract value from a list after the occurrence of a number after certain time


Can use np.roll to find the last index of three consecutive values.

import numpy as np

idx = ((l == np.roll(l, 1)) & (l == np.roll(l, 2))).cumsum().argmax()

l[idx:]
#[1, 2, 4, 1, 3, 5, 2, 2, 6, 4, 1, 6, 1, 1, 3, 5, 2, 2, 6, 4, 1, 6, 2, 7, 2, 6, 1, 1]

2

solved extract value from a list after the occurrence of a number after certain time