df=df.sort_values(['date']).reset_index(drop=True) df["cum_sale"]=df.groupby(['item'])['sale'].cumsum(axis=0)