Created
January 8, 2020 13:10
-
-
Save cereniyim/461094106d6609b25d744975f787e561 to your computer and use it in GitHub Desktop.
Function to calculate correlation coefficient between two columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def corr_func(x, y, **kwargs): | |
r = np.corrcoef(x, y)[0][1] | |
ax = plt.gca() | |
ax.annotate("r = {:.2f}".format(r), | |
xy=(.2, .8), xycoords=ax.transAxes, | |
size = 20) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment