Pandas cumulative sum on column with condition,df.groupby(grouper)['value'].cumsum()