October 2019
Beginner to intermediate
674 pages
16h 43m
English
The corr() function returns the correlation coefficient of each combination of variables in the DataFrame. If any NAs are present, they are excluded for correlation computation. The corr() function accepts the Pearson, Kendall, and Spearman methods. By default, the Pearson correlation coefficient is calculated:
sales_df.corr()
The following is the output:

Just like the correlation function, the cov() function returns the covariance matrix:
sales_df.cov()
The following is the output:

Read now
Unlock full access