I have a dataset like this :
I want to make a two columns of cumulative sum of reference column. But I want to make it reset with two separate condition.
For example, when I meet conditon 1, I want to reset just one column considering condition 1, but not condition 2. In that case, the other column considering only condion 2 should continue without reset.
reference_cumsum=[1,2,3,None,2,4,6,None,1,2,3]
condition=[None,None,None,'condtion1',None,None,None,'conditon2',None,None,None]
pd.DataFrame({'ref_cumsum':reference_cumsum,'event_condition':condition})
I have try a previous solution from this link https://stackoverflow.com/questions/45964740/python-pandas-cumsum-with-reset-everytime-there-is-a-0
But I don't know how to do it with multiple condition.
I have to obtain a dataframe like this :