Skip to content

Commit 8ad1c54

Browse files
committed
DOC: change cov docstring to inline from @doc for SeriesGroupBy
1 parent a85c5c7 commit 8ad1c54

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

pandas/core/groupby/generic.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2276,10 +2276,42 @@ def corr(
22762276
)
22772277
return result
22782278

2279-
@doc(Series.cov.__doc__)
22802279
def cov(
22812280
self, other: Series, min_periods: int | None = None, ddof: int | None = 1
22822281
) -> Series:
2282+
"""
2283+
Compute covariance with Series, excluding missing values.
2284+
2285+
The two `Series` objects are not required to be the same length and
2286+
will be aligned internally before the covariance is calculated.
2287+
2288+
Parameters
2289+
----------
2290+
other : Series
2291+
Series with which to compute the covariance.
2292+
min_periods : int, optional
2293+
Minimum number of observations needed to have a valid result.
2294+
ddof : int, default 1
2295+
Delta degrees of freedom. The divisor used in calculations
2296+
is ``N - ddof``, where ``N`` represents the number of elements.
2297+
2298+
Returns
2299+
-------
2300+
float
2301+
Covariance between Series and other normalized by N-1
2302+
(unbiased estimator).
2303+
2304+
See Also
2305+
--------
2306+
DataFrame.cov : Compute pairwise covariance of columns.
2307+
2308+
Examples
2309+
--------
2310+
>>> s1 = pd.Series([0.90010907, 0.13484424, 0.62036035])
2311+
>>> s2 = pd.Series([0.12528585, 0.26962463, 0.51111198])
2312+
>>> s1.cov(s2)
2313+
-0.01685762652715874
2314+
"""
22832315
result = self._op_via_apply(
22842316
"cov", other=other, min_periods=min_periods, ddof=ddof
22852317
)

0 commit comments

Comments
 (0)