Skip to content

Commit 0414465

Browse files
committed
Fix docstring error
1 parent 72276dc commit 0414465

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

pandas/core/resample.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,12 +1440,61 @@ def var(
14401440
return self._downsample("var", ddof=ddof, numeric_only=numeric_only)
14411441

14421442
@final
1443-
@doc(GroupBy.sem)
14441443
def sem(
14451444
self,
14461445
ddof: int = 1,
14471446
numeric_only: bool = False,
14481447
):
1448+
"""
1449+
Compute standard error of the mean of groups, excluding missing values.
1450+
1451+
For multiple groupings, the result index will be a MultiIndex.
1452+
1453+
Parameters
1454+
----------
1455+
ddof : int, default 1
1456+
Degrees of freedom.
1457+
1458+
numeric_only : bool, default False
1459+
Include only `float`, `int` or `boolean` data.
1460+
1461+
.. versionadded:: 1.5.0
1462+
1463+
.. versionchanged:: 2.0.0
1464+
1465+
numeric_only now defaults to ``False``.
1466+
1467+
Returns
1468+
-------
1469+
Series or DataFrame
1470+
Standard error of the mean of values within each group.
1471+
1472+
See Also
1473+
--------
1474+
DataFrame.sem : Return unbiased standard error of the mean over requested axis.
1475+
Series.sem : Return unbiased standard error of the mean over requested axis.
1476+
1477+
Examples
1478+
--------
1479+
1480+
>>> ser = pd.Series(
1481+
... [1, 3, 2, 4, 3, 8],
1482+
... index=pd.DatetimeIndex(
1483+
... [
1484+
... "2023-01-01",
1485+
... "2023-01-10",
1486+
... "2023-01-15",
1487+
... "2023-02-01",
1488+
... "2023-02-10",
1489+
... "2023-02-15",
1490+
... ]
1491+
... ),
1492+
... )
1493+
>>> ser.resample("MS").sem()
1494+
2023-01-01 0.577350
1495+
2023-02-01 1.527525
1496+
Freq: MS, dtype: float64
1497+
"""
14491498
return self._downsample("sem", ddof=ddof, numeric_only=numeric_only)
14501499

14511500
@final

0 commit comments

Comments
 (0)