pandas.core.window.expanding.Expanding.mean¶
-
Expanding.
mean
(*args, **kwargs)[source]¶ Calculate the expanding mean of the values.
- Parameters
- *args
Under Review.
- **kwargs
Under Review.
- Returns
- Series or DataFrame
Returned object type is determined by the caller of the expanding calculation.
See also
pandas.Series.expanding
Calling object with Series data.
pandas.DataFrame.expanding
Calling object with DataFrames.
pandas.Series.mean
Equivalent method for Series.
pandas.DataFrame.mean
Equivalent method for DataFrame.
Examples
The below examples will show rolling mean calculations with window sizes of two and three, respectively.
>>> s = pd.Series([1, 2, 3, 4]) >>> s.rolling(2).mean() 0 NaN 1 1.5 2 2.5 3 3.5 dtype: float64
>>> s.rolling(3).mean() 0 NaN 1 NaN 2 2.0 3 3.0 dtype: float64