I'm trying to use dataframe to select events. Let's say I have only two kinds of events: 1, -1 and the following dataframe:
a=pd.DataFrame({'ev':[1,1,-1,1,1,1,-1,-1]})
with:
a[a['ev']>0]
I can select only the 1 events. Now I would like to count how many consecutive events I have; in this case I would like to get [2,3]
The point is: how to get the list (or the series) of the indexes involved in a[a['ev']>0]
?