Compute the running (cumulative) maximum for a series in pandas

Use cummax

df.High.cummax()

0    954
1    954
2    954
3    955
4    956
5    956
6    956
7    956
Name: High, dtype: int64

df['Max'] = df.High.cummax()
df

enter image description here

Leave a Comment