Compute covariance with Series, excluding missing values.
The two Series objects are not required to be the same length and will be aligned internally before the covariance is calculated.
Series with which to compute the covariance.
Minimum number of observations needed to have a valid result.
Delta degrees of freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.
Covariance between Series and other normalized by N-1 (unbiased estimator).
See also
DataFrame.covCompute pairwise covariance of columns.
Examples
>>> s1 = pd.Series([0.90010907, 0.13484424, 0.62036035])
>>> s2 = pd.Series([0.12528585, 0.26962463, 0.51111198])
>>> s1.cov(s2)
-0.01685762652715874
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.core.groupby.SeriesGroupBy.cov.html