当优先指数为分母和数字时,Pandascumprod

2024-04-29 10:26:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一只熊猫SeriesDivFactor),我想用cumprod计算。它依赖于另外两个给定的序列:AdjClose和{}。在

以下是我当前的循环:

DivFactor[0] = 1
for t in range(1, periods):
    DivFactor[t] = DivFactor[t-1] - (Div[t-1] * DivFactor[t-1]) /
                                     (AdjClose[t] / DivFactor[t-1] + Div[t-1]))

问题是,这个公式似乎很难用累积积来表示。在

有没有一种方法可以重新计算DivFactor,这样我就可以使用pandas cumprod(或另一个累积函数)而避免使用Python循环?在


Tags: 方法函数indivpandasforrange序列