1
这两种关系有可能有所不同吗?pandas spearman相关性很奇怪吗?
大熊猫版本0.18.1
from pandas import Series
a = ['Arsenal', 'Leicester', 'Man City', 'Tottenham', 'Crystal Palace']
b = ['Arsenal', 'Leicester', 'Man City', 'Tottenham', 'Man United']
c = ['Arsenal', 'Leicester', 'Man City', 'Tottenham', 'Man United']
d = ['Arsenal', 'Leicester', 'Man City', 'Tottenham', 'West Ham']
Series(a).corr(Series(b), method="spearman")
0.69999999999999996
Series(c).corr(Series(d), method="spearman")
0.8999999999999998
python 3.5.2和anaconda 4.4.1 –
熊猫必须以某种方式排列这些字符串,因此它们按字母顺序排列。因此,根据其他球队的存在情况,球队的排名可能会有所不同。所以熊猫正在计算“正确”,但这不是你想要的操作。 –
我不是统计学家,但不需要在两个数字系列上完成相关性?你期待什么作为输出?在熊猫0.19.2上面的示例代码崩溃,因为字符串不是浮动的。 – nico