<分区>
你好有以下数据框(df)
temp
0 10
1 23
2 12
5 24
我努力实现:
temp max_so_far
0 10 10
1 23 23
2 12 23
5 24 24
我正在尝试使用:
df['max_so_far'] = df.temp.rolling(window= df.index).max
df['max_so_far'] = df.temp.rolling(window= df.index.astype(int)).max
但是我总是得到窗口必须是整数的错误。关于如何解决这个问题的任何建议
谢谢