pearson correlation python code example
Example 1: python pearson correlation
import scipy
# x and y are numpy array with shape (N,)
coeff, _ = scipy.stats.pearsonr(x, y)
Example 2: Pearson correlation
The usual definition of correlation. Technically,
Corr[X,Y] = Cov[X,Y]/(Std[X] * Std[Y]).