Pandas Series: corr() function

Compute correlation

The corr() function is used to compute correlation with other Series, excluding missing values.


Series.corr(self, other, method='pearson', min_periods=None)


Name Description Type/Default Value Required / Optional
other Series with which to compute the correlation. Series Required
  • pearson : standard correlation coefficient
  • kendall : Kendall Tau correlation coefficient
  • spearman : Spearman rank correlation
  • callable: callable with input two 1d ndarrays
  • and returning a float. Note that the returned matrix from corr will have 1 along the diagonals and will be symmetric regardless of the callable’s behavior .. versionadded:: 0.24.0
{‘pearson’, ‘kendall’, ‘spearman’} or callable Required
min_periods Minimum number of observations needed to have a valid result. int Optional

Returns: float
Correlation with other.


Download the Pandas Series Notebooks from here.

Previous: Trim values at input in Pandas
Next: Count null observations in Pandas series