How to get correlation value? #54145
-
Select Topic AreaQuestion BodyI want to get correlation value of two array. How to get? |
Beta Was this translation helpful? Give feedback.
Answered by
smart9205
May 1, 2023
Replies: 1 comment
-
|
You can calculate correlation value easily using numpy. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Ovital
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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]