Skip to content

Commit f40aa16

Browse files
committed
Fix docstring error
1 parent e259679 commit f40aa16

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

pandas/core/resample.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,53 @@ def last(
12591259
)
12601260

12611261
@final
1262-
@doc(GroupBy.median)
12631262
def median(self, numeric_only: bool = False):
1263+
"""
1264+
Compute median of groups, excluding missing values.
1265+
1266+
For multiple groupings, the result index will be a MultiIndex
1267+
1268+
Parameters
1269+
----------
1270+
numeric_only : bool, default False
1271+
Include only float, int, boolean columns.
1272+
1273+
.. versionchanged:: 2.0.0
1274+
1275+
numeric_only no longer accepts ``None`` and defaults to False.
1276+
1277+
Returns
1278+
-------
1279+
Series or DataFrame
1280+
Median of values within each group.
1281+
1282+
See Also
1283+
--------
1284+
Series.groupby : Apply a function groupby to a Series.
1285+
DataFrame.groupby : Apply a function groupby to each row or column of a
1286+
DataFrame.
1287+
1288+
Examples
1289+
--------
1290+
1291+
>>> ser = pd.Series(
1292+
... [1, 2, 3, 3, 4, 5],
1293+
... index=pd.DatetimeIndex(
1294+
... [
1295+
... "2023-01-01",
1296+
... "2023-01-10",
1297+
... "2023-01-15",
1298+
... "2023-02-01",
1299+
... "2023-02-10",
1300+
... "2023-02-15",
1301+
... ]
1302+
... ),
1303+
... )
1304+
>>> ser.resample("MS").median()
1305+
2023-01-01 2.0
1306+
2023-02-01 4.0
1307+
Freq: MS, dtype: float64
1308+
"""
12641309
return self._downsample("median", numeric_only=numeric_only)
12651310

12661311
@final

0 commit comments

Comments
 (0)