VOOZH about

URL: https://www.geeksforgeeks.org/python/compute-pearson-product-moment-correlation-coefficients-of-two-given-numpy-arrays/

⇱ Compute pearson product-moment correlation coefficients of two given NumPy arrays - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Compute pearson product-moment correlation coefficients of two given NumPy arrays

Last Updated : 2 Sep, 2020

In NumPy, We can compute pearson product-moment correlation coefficients of two given arrays with the help of numpy.corrcoef() function.

In this function, we will pass arrays as a parameter and it will return the pearson product-moment correlation coefficients of two given arrays.

Syntax: numpy.corrcoef(x, y=None, rowvar=True, bias=, ddof=) Return: Pearson product-moment correlation coefficients
Let's see an example:

Example 1:

Output

[[1. 1.]
 [1. 1.]]

Example 2:

Output

[[ 1. -0.98198051]
 [-0.98198051 1. ]]
Comment