xorbits.pandas.Series.cov#

Series.cov(other: Series, min_periods: int | None = None, ddof: int | None = 1) float[源代码]#

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.

参数
  • other (Series) – Series with which to compute the covariance.

  • min_periods (int, optional) – Minimum number of observations needed to have a valid result.

  • ddof (int, default 1) – 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).

返回类型

float

参见

DataFrame.cov

Compute pairwise covariance of columns.

实际案例

>>> s1 = pd.Series([0.90010907, 0.13484424, 0.62036035])  
>>> s2 = pd.Series([0.12528585, 0.26962463, 0.51111198])  
>>> s1.cov(s2)  
-0.01685762652715874

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.series.Series.