I have two numpy arrays
X.shape = (100, 10)
Y.shape = (100, 10)
I want to find the pearson correlations between columns of X and Y
i.e.
from scipy.stats.stats import pearsonr
def corr( X, Y ):
return np.array([ pearsonr( x, y )[0] for x,y in zip( X.T, Y.T ) ] )
corr( X, Y ).shape = (10, )
Is there a function for this? So far, all the functions I can find calculate correlation matrices. There is a pairwise correlation function in Matlab, so I'm pretty sure someone must have written one for Python.
The reason why I don't like the example function above is because it seems slow.