Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

accumulating number per group

i'm trying to accumulate numbers per group per year.

df = pd.DataFrame({
'group number': [1,1,1,1,3,3,3],
'year': ['2012','2013','2014','2015','2011','2012','2013'],
'trend': [0,'1','1','-1',0,'-1','1']}) 

so the new field that i'm trying to create will be for each group accumulating for every year.

group 1 will have :

group 1

group 3 will have group 3

thanks

Comments