Pandas Cummax
import pandas as pd
s = pd.Series([0, 1, -2, 5, 10, -3])
s.cummax()
>>>
0 0
1 1
2 1
3 5
4 10
5 10
dtype: int64
wolf-like_hunter
import pandas as pd
s = pd.Series([0, 1, -2, 5, 10, -3])
s.cummax()
>>>
0 0
1 1
2 1
3 5
4 10
5 10
dtype: int64