测向校正()只显示1和0值?

2024-04-26 20:37:35 发布

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

通过计算数据帧中元素的相关性时测向校正(),它只返回0或1?比如:

在测向校正()

                 rain      sun     temperature   likes    comments
rain              1         0          0          0          0
sun               0         1          0          1          0
temperature       0         0          1          0          0
likes             0         1          0          1          0
comments          0         0          0          0          1

当我通过scipy.stats.pearsonr公司(东风太阳,df.喜欢),它返回

(0.62554951411549231, 0.0)

这是一种奇怪的舍入行为吗?你知道吗

已解决:pd.选项.显示.float\u format='{.3f}'。格式


Tags: 数据元素dfstats公司scipycommentspd