I have the below df:
import pandas as pd
frames = [9,12,14,15,16,17,18,22,23,24,25,30]
counter = [0,0,0,0,1,1,1,0,0,1,1,0]
df = pd.DataFrame({'frames':frames, 'counter':counter})
print(df)
frames counter
0 9 0
1 12 0
2 14 0
3 15 0
4 16 1
5 17 1
6 18 1
7 22 0
8 23 0
9 24 1
10 25 1
11 30 0
without using a for loop, how can i get the (start, end) frames where the counter is 1(True)?
result:
[(16,18), (24,25)]