Skip to content

Instantly share code, notes, and snippets.

@cereniyim
Created January 8, 2020 13:10
Show Gist options
  • Save cereniyim/461094106d6609b25d744975f787e561 to your computer and use it in GitHub Desktop.
Save cereniyim/461094106d6609b25d744975f787e561 to your computer and use it in GitHub Desktop.
Function to calculate correlation coefficient between two columns
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