diff --git a/pandas/core/series.py b/pandas/core/series.py index e59a4cfc3fcc1..164b1a61b006c 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2783,6 +2783,9 @@ def corr( * `Kendall rank correlation coefficient `_ * `Spearman's rank correlation coefficient `_ + Automatic data alignment: as with all pandas operations, automatic data alignment is performed for this method. + ``corr()`` automatically considers values with matching indices. + Examples -------- >>> def histogram_intersection(a, b): @@ -2792,6 +2795,13 @@ def corr( >>> s2 = pd.Series([.3, .6, .0, .1]) >>> s1.corr(s2, method=histogram_intersection) 0.3 + + Pandas auto-aligns the values with matching indices + + >>> s1 = pd.Series([1, 2, 3], index=[0, 1, 2]) + >>> s2 = pd.Series([1, 2, 3], index=[2, 1, 0]) + >>> s1.corr(s2) + -1.0 """ # noqa: E501 this, other = self.align(other, join="inner", copy=False) if len(this) == 0: