Join Data Science Interview MasterClass (in 3 weeks) 🚀 led by FAANG Data Scientists | Just 6 seats remaining...

Back to Questions

3. Pearson Correlation

medium
GoogleGoogle
entry

Given two arrays of numbers representing paired observations, compute the Pearson correlation coefficient rr between them using NumPy.

Return the correlation coefficient rounded to 2 decimal places.

Input Signature
ArgumentType
nums1np.ndarray
nums2np.ndarray
Output Signature
Return NameType
valuefloat

Constraints

  • 2≤n≤1052 \le n \le 10^5 where nn is the length of each array.

  • The two input arrays must have the same length.

Roles
Data Scientist
Companies
GoogleGoogle
Levels
entry
Tags
numpy

Similar Questions

Meaneasy
stats coding
Covariancemedium
stats coding
Sample Varianceeasy
stats coding
32 people are solving this problem
Python LogoPython Editor
Ln 1, Col 1

Input Arguments

Edit values below to test with custom inputs

You need tolog in/sign upto run or submit