mean¶
-
mean
(x, w=Window(w=None, r=0))[source]¶ Arithmetic mean of series over given window
- Parameters
x (
Series
) – series: timeseriesw (
Union
[Window
,int
]) – Window or int: number of observations and ramp up to use. e.g. Window(22, 10) where 22 is the window size
and 10 the ramp up value. Window size defaults to length of series. :rtype:
Series
:return: timeseries of mean valueUsage
Calculates arithmetic mean of the series over a rolling window
\(R_t = \frac{\sum_{i=t-w+1}^{t} X_i}{N}\)
where \(N\) is the number of observations in each rolling window, \(w\). If window is not provided, computes rolling mean over the full series. If the window size is greater than the available data, will return mean of available values.
Examples
Generate price series and compute mean over \(22\) observations
>>> prices = generate_series(100) >>> mean(prices, 22)
See also