Skip to content

Instantly share code, notes, and snippets.

@Ayushijain09
Last active July 14, 2020 03:10
Show Gist options
  • Save Ayushijain09/86b6567ea30ca491a4da1012c1faa1da to your computer and use it in GitHub Desktop.
Save Ayushijain09/86b6567ea30ca491a4da1012c1faa1da to your computer and use it in GitHub Desktop.
#USING SCIPY
from scipy.stats import spearmanr
from scipy.stats import pearsonr
from scipy.stats import kendalltau
coef, p = pearsonrr(x, y) #Pearson's r
coef, p = spearmanr(x, y) # Spearman's rho
coef, p = kendalltau(x, y) # Kendall's tau
#USING PANDAS
x.corr(y) #Pearson's r
x.corr(y, method='spearman') # Spearman's rho
x.corr(y, method='kendall') # Kendall's tau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment