Skip to main content
`Ctrl`+`K`

# pandas.api.typing.SeriesGroupBy.cov

SeriesGroupBy.cov(other, min_periods=None, ddof=1)

  Compute covariance between each group and another Series.

  This method computes the sample covariance between each group’s values and the corresponding values in `other`.

  Parameters:
    other Series

      Series to compute covariance with.

    min_periods int, optional

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

    ddof int, optional

      Delta degrees of freedom for variance calculation.

  Returns:
    Series

      Covariance value for each group.

  See also

  `Series.cov`

    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.cov()