我发现了熊猫 compound dataframe method documentation 但它确实很简洁。我试着在一个简单的数据帧上运行它,但不了解它的实用性。下面是我的例子:
In [5]: df = pd.DataFrame(np.arange(6).reshape(3,2), columns=['a', 'b']) In [6]: df Out[6]: a b 0 0 1 1 2 3 2 4 5 In [7]: df.compound() Out[7]: a 14 b 47 dtype: int32
我应该用这个方法做什么?
这更像是贷款计算——复利
df.compound() Out[143]: a 14 b 47 dtype: int32
所以对于列 a
a