强文如何计算熊猫中的曲线? excel curve 10点开始曲线
A curve i_want_that
0 1 NaN 10
1 5 6.0 15
2 3 8.0 18
3 4 7.0 22
4 5 9.0 27
5 6 11.0 33
6 7 13.0 40
7 8 15.0 48
答案 0 :(得分:1)
这就是你要找的东西:
df = pd.DataFrame({'A': [1, 5, 3, 4]})
df['curve'] = df['A'] - df['A'].shift(1)
如你所愿:
df['whatYouWant'] = 9 + df['A'].cumsum()