【发布时间】:2020-06-23 03:42:12
【问题描述】:
我有两个 pandas 数据框,我只从一列中获取并将日期列设置为索引,所以现在我有两个 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
来自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
我试过了:
correlation=dfp.corr(dfd)
并得到以下错误:
TypeError: unsupported operand type(s) for /: 'str' and 'int'
【问题讨论】:
标签: python pandas dataframe time-series correlation