小编Sha*_*yag的帖子

找到熊猫时间序列之间的相关性

我有两个熊猫数据框,我只从一列中获取并将日期列设置为索引,所以现在我有两个系列。我需要找到这些 Series 的相关性

以下是几行dfd

index      change
2018-12-31  -0.86
2018-12-30  0.34
2018-12-27  -0.94
2018-12-26  -1.26
2018-12-25  3.30
2018-12-24  -4.17
Run Code Online (Sandbox Code Playgroud)

来自dfp

index      change
2018-12-31  0.55
2018-12-30  0.81
2018-12-27  -2.99
2018-12-26  0.50
2018-12-25  3.59
2018-12-24  -3.43
Run Code Online (Sandbox Code Playgroud)

我试过:

correlation=dfp.corr(dfd)
Run Code Online (Sandbox Code Playgroud)

并得到以下错误:

TypeError: unsupported operand type(s) for /: 'str' and 'int'
Run Code Online (Sandbox Code Playgroud)

python time-series correlation dataframe pandas

3
推荐指数
1
解决办法
74
查看次数

标签 统计

correlation ×1

dataframe ×1

pandas ×1

python ×1

time-series ×1