Rolling Windows
Rolling Windows
apply_rolling_data(values, function, window, step=1)
Perform a rolling window analysis at the column col from data
Given a dataframe data with time series, call function at sections of length window at the data of column col. Append the results to data at a new columns with name label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values |
ndarray
|
1-D Time series of data |
required |
function |
Callable[[ndarray], ndarray]
|
Function to be called to calculate the rolling window analysis, the function must receive as input an array or pandas series. Its output must be either a number or a pandas series |
required |
window |
int
|
Length of the window to perform the analysis |
required |
step |
int
|
Step to take between two consecutive windows, by default 1 |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
data |
array
|
Columns generated by the function applied |