【发布时间】:2020-12-02 12:26:36
【问题描述】:
price
price
date
2010-01-04 34.57282657
2010-01-04 123.900000
2010-01-04 353.6789738
2010-01-04 13.08
2010-01-04 12.45
如何为下面列表中的每个项目创建一阶差分数据框?代码需要通用。 我试过了:
listxx = ["price"]
for x in listxx:
globals().update({x_first_diff :x.diff().dropna()})
Expected Output:
price_first_diff
price_first_diff
2010-01-04
2010-01-04 89.33
...
【问题讨论】:
标签: python python-3.x pandas list dataframe