Scipy: Pearson's correlation always returning 1
问题 I am using Python library scipy to calculate Pearson's correlation for two float arrays. The returned value for coefficient is always 1.0, even if the arrays are different. For example: [-0.65499887 2.34644428] [-1.46049758 3.86537321] I am calling the routine in this way: r_row, p_value = scipy.stats.pearsonr(array1, array2) The value of r_row is always 1.0. What am I doing wrong? 回答1: Pearson's correlation coefficient is a measure of how well your data would be fitted by a linear regression