Skip to content

Commit 9fb69e6

Browse files
authored
DOC: Updated Resampler.mean docstring to have its own docstring (#48980)
* DOC: Added mean function as method of Resampler and updated docstring * removed versionadded
1 parent 295bc76 commit 9fb69e6

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pandas/core/resample.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,28 @@ def asfreq(self, fill_value=None):
984984
"""
985985
return self._upsample("asfreq", fill_value=fill_value)
986986

987+
def mean(
988+
self,
989+
numeric_only: bool | lib.NoDefault = lib.no_default,
990+
*args,
991+
**kwargs,
992+
):
993+
"""
994+
Compute mean of groups, excluding missing values.
995+
996+
Parameters
997+
----------
998+
numeric_only : bool, default False
999+
Include only `float`, `int` or `boolean` data.
1000+
1001+
Returns
1002+
-------
1003+
DataFrame or Series
1004+
Mean of values within each group.
1005+
"""
1006+
nv.validate_resampler_func("mean", args, kwargs)
1007+
return self._downsample("mean", numeric_only=numeric_only)
1008+
9871009
def std(
9881010
self,
9891011
ddof: int = 1,
@@ -1173,7 +1195,7 @@ def f( # type: ignore[misc]
11731195

11741196
for method in ["sum", "prod", "min", "max", "first", "last"]:
11751197
_add_downsample_kernel(method, ("numeric_only", "min_count"))
1176-
for method in ["mean", "median"]:
1198+
for method in ["median"]:
11771199
_add_downsample_kernel(method, ("numeric_only",))
11781200
for method in ["sem"]:
11791201
_add_downsample_kernel(method, ("ddof", "numeric_only"))

0 commit comments

Comments
 (0)