Skip to content
Discussion options

You must be logged in to vote

You can calculate correlation value easily using numpy.
Here is the code :
import numpy as np
x = np.array([1, 2, 3, 4, 5])
y = np.array([5, 4, 3, 2, 1])
corr_matrix = np.corrcoef(x, y)
corr_coeff = corr_matrix[0, 1]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ovital
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussions GitHub Discussions is a collaborative communication feature Question Ask and answer questions about GitHub features and usage
2 participants