Rolling
Regular
rolling_mean
rolling_mean (input_array:numpy.ndarray, window_size:int, min_samples:Optional[int]=None)
Compute the rolling_mean over the last non-na window_size samples of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
rolling_std
rolling_std (input_array:numpy.ndarray, window_size:int, min_samples:Optional[int]=None)
Compute the rolling_std over the last non-na window_size samples of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
rolling_max
rolling_max (input_array:numpy.ndarray, window_size:int, min_samples:Optional[int]=None)
Compute the rolling_max over the last non-na window_size samples of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
rolling_min
rolling_min (x:numpy.ndarray, window_size:int, min_samples:Optional[int]=None)
Compute the rolling_min over the last non-na window_size samples of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
x | ndarray | ||
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
rolling_correlation
rolling_correlation (x:numpy.ndarray, window_size:int)
Calculates the rolling correlation of a time series.
Type | Details | |
---|---|---|
x | ndarray | Array of time series data. |
window_size | int | Size of the sliding window. |
Returns | ndarray | Array with the rolling correlation for each point in time. |
rolling_cv
rolling_cv (x:numpy.ndarray, window_size:int)
Calculates the rolling coefficient of variation (CV) over a specified window.
Type | Details | |
---|---|---|
x | ndarray | Array of time series data. |
window_size | int | Size of the sliding window. |
Returns | ndarray | An array with the rolling CV for each point in time. |
rolling_mean_positive_only
rolling_mean_positive_only (x:numpy.ndarray, window_size:int)
Calculates the rolling mean considering only positive sales days, ignoring effects of zero demand.
Type | Details | |
---|---|---|
x | ndarray | Array of sales data. |
window_size | int | Size of the sliding window. |
Returns | ndarray | An array with the rolling mean for each point in time, considering only days with positive sales. |
rolling_kurtosis
rolling_kurtosis (x:numpy.ndarray, window_size:int)
Calculates the rolling kurtosis, helping identify the presence of outliers in sales and how data deviates from a normal distribution.
Type | Details | |
---|---|---|
x | ndarray | Array of sales data. |
window_size | int | Size of the sliding window. |
Returns | ndarray | Array with the rolling kurtosis for each point in time. |
rolling_average_days_with_sales
rolling_average_days_with_sales (x:numpy.ndarray, window_size:int)
Calculates the average number of days with sales over a window. Useful for understanding the sales frequency of each SKU.
Type | Details | |
---|---|---|
x | ndarray | Array of sales data. |
window_size | int | Size of the sliding window. |
Returns | ndarray | Array with the average number of days with sales for each point in time. |
Seasonal
seasonal_rolling_mean
seasonal_rolling_mean (input_array:numpy.ndarray, season_length:int, window_size:int, min_samples:Optional[int]=None)
Compute the seasonal_rolling_mean over the last non-na window_size samples for each seasonal period of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
season_length | int | Length of the seasonal period | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
seasonal_rolling_std
seasonal_rolling_std (input_array:numpy.ndarray, season_length:int, window_size:int, min_samples:Optional[int]=None)
Compute the seasonal_rolling_std over the last non-na window_size samples for each seasonal period of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
season_length | int | Length of the seasonal period | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
seasonal_rolling_max
seasonal_rolling_max (input_array:numpy.ndarray, season_length:int, window_size:int, min_samples:Optional[int]=None)
Compute the seasonal_rolling_max over the last non-na window_size samples for each seasonal period of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
input_array | ndarray | Input array | |
season_length | int | Length of the seasonal period | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |
seasonal_rolling_min
seasonal_rolling_min (x:numpy.ndarray, season_length:int, window_size:int, min_samples:Optional[int]=None)
Compute the seasonal_rolling_min over the last non-na window_size samples for each seasonal period of the input array starting at min_samples.
Type | Default | Details | |
---|---|---|---|
x | ndarray | ||
season_length | int | Length of the seasonal period | |
window_size | int | Size of the sliding window | |
min_samples | Optional | None | Minimum number of samples to produce a result, if None then it’s set to window_size |
Returns | ndarray | Array with rolling computation |