Is there a way to cumsum values in column based on the value of another column but after the condition is no more respected, resetting the cumsum? In the below image, the conditioning factor is on 'Rbin' being equal to one.
random_data_frame = pandas.DataFrame()
random_data_frame['Rbin'] = [0,1,1,1,0,0,1,0]
random_data_frame['Rmomentum'] = [-0.07,0.03,0.06,0.005,-0.008,-0.8,0.8,-0.5]