Python 熊猫按日复利的计算方法

Python 熊猫按日复利的计算方法,python,pandas,Python,Pandas,如果我有一个数据帧,如: date value 2015-01-01 1.1 2015-01-01 1.2 2015-01-01 1.1 2015-01-01 1.1 我想得到: date value compound value 2015-01-01 1.1 1.1 2015-01-01 1.2 1.1*1.2 2015-01-01 1.1 1.1*1.2*1.1 2015-01-01 1.1 1.1*1.2*1.1*1.1 熊猫有什么简单的解决方法

如果我有一个数据帧,如:

date       value
2015-01-01 1.1
2015-01-01 1.2
2015-01-01 1.1
2015-01-01 1.1
我想得到:

date       value compound value
2015-01-01  1.1  1.1
2015-01-01  1.2  1.1*1.2
2015-01-01  1.1  1.1*1.2*1.1
2015-01-01  1.1  1.1*1.2*1.1*1.1
熊猫有什么简单的解决方法吗?

您想要:


谢谢这正是我想要的!酷,你能接受我的答案吗,这样就不会一直没有答案,我的答案左上角会有一个空的勾号,谢谢。我相信你的日期是错的。它们应该是连续的。
In [7]:
df['compound'] = df['value'].cumprod()
df

Out[7]:
         date  value  compound
0  2015-01-01    1.1    1.1000
1  2015-01-01    1.2    1.3200
2  2015-01-01    1.1    1.4520
3  2015-01-01    1.1    1.5972