I have a time series data frame df1 like this:
DateTime Power[HP] PowerJump PowerStart
01/01/2018 0 0 0
01/02/2018 10 0 1
01/03/2018 99 1 0
01/04/2018 20 0 0
01/05/2018 60 0 0
01/06/2018 70 0 0
01/07/2018 15 0 0
01/08/2018 95 1 0
01/09/2018 0 0 0
01/10/2018 10 0 1
01/11/2018 0 0 0
01/12/2018 95 1 1
Power Jump tags cases where power increased at least 20HP to 90HP or more. Power Starts tags every case where engine started producing power.
Now I would like to count cycles where cycle is either power production start or power jump. When power start is followed by the power jump it is counted as one.
There are 4 cycles in total for this data sample.
This is the expected output:
DateTime Power[HP] PowerJump PowerStart Cycle
01/01/2018 0 0 0 0
01/02/2018 10 0 1 1
01/03/2018 99 1 0 0
01/04/2018 20 0 0 0
01/05/2018 60 0 0 0
01/06/2018 70 0 0 0
01/07/2018 15 0 0 0
01/08/2018 95 1 0 1
01/09/2018 0 0 0 0
01/10/2018 10 0 1 1
01/11/2018 0 0 0 0
01/12/2018 95 1 1 1
