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:
The corr() function
Just like the correlation function, the cov() function returns the covariance matrix:
sales_df.cov()
The following is the output:
The cov() function
The min_periods argument in corr() and cov() decides the minimal presence of non-NA values in the DataFrame.