dython correlation python code example
Example 1: correlation python
import numpy as np
import scipy.stats
x = np.arange(15, 20)
y = np.arange(5, 10)
stat, p = scipy.stats.pearsonr(x, y)
Example 2: python pearson correlation
import scipy
# x and y are numpy array with shape (N,)
coeff, _ = scipy.stats.pearsonr(x, y)