cumulative difference in pandas series code example
Example 1: cumulative percentaile pandas
df['cum_sum'] = df["val1"].cumsum()
df['cum_perc'] = round(100*df.cum_sum/df["val1"].sum(),2)
Example 2: pandas cumulative mean
df['value'].expanding().mean()