Given:
d = {
'High': [954,
953,
952,
955,
956,
952,
951,
950,
]
}
df = pandas.DataFrame(d)
I want to add another column which is the max at each index from the beginning. For example the desired column would be:
'Max': [954,
954,
954,
955,
956,
956,
956,
956]
I tried with a pandas rolling function but the window cannot be dynamic it seems
来源:https://stackoverflow.com/questions/39498729/compute-the-running-cumulative-maximum-for-a-series-in-pandas