@@ -983,6 +983,30 @@ def asfreq(self, fill_value=None):
983
983
DataFrame.asfreq: Convert TimeSeries to specified frequency.
984
984
"""
985
985
return self ._upsample ("asfreq" , fill_value = fill_value )
986
+
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
+ .. versionadded:: 1.5.0
1002
+
1003
+ Returns
1004
+ -------
1005
+ DataFrame or Series
1006
+ Mean of values within each group.
1007
+ """
1008
+ nv .validate_resampler_func ("mean" , args , kwargs )
1009
+ return self ._downsample ("mean" , numeric_only = numeric_only )
986
1010
987
1011
def std (
988
1012
self ,
@@ -1173,7 +1197,7 @@ def f( # type: ignore[misc]
1173
1197
1174
1198
for method in ["sum" , "prod" , "min" , "max" , "first" , "last" ]:
1175
1199
_add_downsample_kernel (method , ("numeric_only" , "min_count" ))
1176
- for method in ["mean" , " median" ]:
1200
+ for method in ["median" ]:
1177
1201
_add_downsample_kernel (method , ("numeric_only" ,))
1178
1202
for method in ["sem" ]:
1179
1203
_add_downsample_kernel (method , ("ddof" , "numeric_only" ))
0 commit comments