So according to this answer, it is better not to iterate over rows in a Pandas DataFrame. However, I don't know how to solve my problem without using a for-loop.
I need to detect any consecutive repetition (three or more times) in a particular column. So, for example, if the value 0 appears in three consecutive rows for a particular ID, I want to know the ID.
ID Value
1 0
1 0.5
1 0 <--- I need this ID, because there are three consecutive 0s.
1 0
1 0
1 0.2
2 0.1
2 0 <--- Not this one! It only appears twice in a row for this ID.
2 0
3 0
3 0
Maybe it's worth mentioning that it's a time series, so the order is crucial.