Skip to main content
`Ctrl`+`K`

# pandas.api.typing.SeriesGroupBy.corr

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

  Compute correlation between each group and another Series.

  Parameters:
    other Series

      Series to compute correlation with.

    method{‘pearson’, ‘kendall’, ‘spearman’}, default ‘pearson’

      Method of correlation to use.

    min_periods int, optional

      Minimum number of observations required per pair of columns to have a valid result.

  Returns:
    Series

      Correlation value for each group.

  See also

  `Series.corr`

    Equivalent method on `Series`.

  Examples

      >>> s = pd.Series([1, 2, 3, 4], index=[0, 0, 1, 1])
      >>> g = s.groupby([0, 0, 1, 1])
      >>> g.corr()