pandas.core.resample.Resampler.mean#
- finalResampler.mean(numeric_only=False, *args, **kwargs)[source] #
Compute mean of groups, excluding missing values.
- Parameters:
- numeric_onlybool, default False
Include only float, int or boolean data.
Changed in version 2.0.0: numeric_only now defaults to
False
.
- Returns:
- DataFrame or Series
Mean of values within each group.
Examples
>>> ser = pd.Series([1, 2, 3, 4], index=pd.DatetimeIndex( ... ['2023年01月01日', '2023年01月15日', '2023年02月01日', '2023年02月15日'])) >>> ser 2023年01月01日 1 2023年01月15日 2 2023年02月01日 3 2023年02月15日 4 dtype: int64 >>> ser.resample('MS').mean() 2023年01月01日 1.5 2023年02月01日 3.5 Freq: MS, dtype: float64