@@ -973,6 +973,30 @@ def asfreq(self, fill_value=None):
973
973
DataFrame.asfreq: Convert TimeSeries to specified frequency.
974
974
"""
975
975
return self ._upsample ("asfreq" , fill_value = fill_value )
976
+
977
+ def mean (
978
+ self ,
979
+ numeric_only : bool | lib .NoDefault = lib .no_default ,
980
+ * args ,
981
+ ** kwargs ,
982
+ ):
983
+ """
984
+ Compute mean of groups, excluding missing values.
985
+
986
+ Parameters
987
+ ----------
988
+ numeric_only : bool, default False
989
+ Include only `float`, `int` or `boolean` data.
990
+
991
+ .. versionadded:: 1.5.0
992
+
993
+ Returns
994
+ -------
995
+ DataFrame or Series
996
+ Mean of values within each group.
997
+ """
998
+ nv .validate_resampler_func ("mean" , args , kwargs )
999
+ return self ._downsample ("mean" , numeric_only = numeric_only )
976
1000
977
1001
def std (
978
1002
self ,
@@ -1163,7 +1187,7 @@ def f( # type: ignore[misc]
1163
1187
1164
1188
for method in ["sum" , "prod" , "min" , "max" , "first" , "last" ]:
1165
1189
_add_downsample_kernel (method , ("numeric_only" , "min_count" ))
1166
- for method in ["mean" , " median" ]:
1190
+ for method in ["median" ]:
1167
1191
_add_downsample_kernel (method , ("numeric_only" ,))
1168
1192
for method in ["sem" ]:
1169
1193
_add_downsample_kernel (method , ("ddof" , "numeric_only" ))
0 commit comments