Maybe I made a mistake. If so, I am sorry to ask this.
I want to calculate Pearson\'s correlation coefficent by using scipy\'s pearsonr
function.
Pearson's correlation coefficient between two variables is defined as the covariance of the two variables divided by the product of their standard deviations.
So it's the covariance over
[4, 5, 5, 4, 4, 4]
times [4, 4, 4, 4, 4, 4]
.The standard deviation of [4, 4, 4, 4, 4, 4]
is zero.
So it's the covariance over
[4, 5, 5, 4, 4, 4]
times So it's the covariance over
Anything divided by zero is nan
. The value of the covariance is irrelevant.