Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,28 @@ def asfreq(self, fill_value=None):
"""
return self._upsample("asfreq", fill_value=fill_value)

def mean(
self,
numeric_only: bool | lib.NoDefault = lib.no_default,
*args,
**kwargs,
):
"""
Compute mean of groups, excluding missing values.

Parameters
----------
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.

Returns
-------
DataFrame or Series
Mean of values within each group.
"""
nv.validate_resampler_func("mean", args, kwargs)
return self._downsample("mean", numeric_only=numeric_only)

def std(
self,
ddof: int = 1,
Expand Down Expand Up @@ -1173,7 +1195,7 @@ def f( # type: ignore[misc]

for method in ["sum", "prod", "min", "max", "first", "last"]:
_add_downsample_kernel(method, ("numeric_only", "min_count"))
for method in ["mean", "median"]:
for method in ["median"]:
_add_downsample_kernel(method, ("numeric_only",))
for method in ["sem"]:
_add_downsample_kernel(method, ("ddof", "numeric_only"))
Expand Down