通过df.corr()计算DataFrame中元素的相关性时,它只返回0或1?像:
df.corr()
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.sun,df.likes)计算时,它会返回
(0.62554951411549231, 0.0)
这是一种奇怪的舍入行为吗?
已解决:pd.options.display.float_format =' {:。3f}' .format