Rolling

Compute a rolling value over a time window or number of values using mean, sum, min, max, or count.

The rolling function has the following syntax:

rolling(<variable>, <aggregation_method>, <type_of_range>, <range>, min_periods = 2)

Parameter
Description
Value
Mandatory

Variable

Represents the measurements of a sensor as a time seriesarrow-up-right of data points that vary over time. Also known as "dots"arrow-up-right, it is identified by a variable label.

Variable label

YES

Aggregation method

Computes the elements of a time series to return a single summary value.

meanmean, sumsum, minmin, maxmax, countcount

YES

Type of range

Indicates whether a date range or a fixed number of elements is used to sample the time series.

windowwindow or valuesvalues

YES

Range

The time window in which the function is computed.

Note: Set the selected range for a "window" so it evenly divides the next range. For example, if you use minutes ("T"), the number n must evenly divide an hour ("H"). Available minute values are 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30. Other values may produce unexpected results. The same applies to other ranges.

Available data ranges:

This is a positive integer that represents the number of observations used for each window, or a time range specified as follows:

"nT""nT": Every n minutes

"nH""nH": Every n hours

"nD""nD": Every n days

YES

Min periods

Number of values needed to calculate the rolling aggregation. By default, it is set to 2, which is the minimum required.

min_periods = n, where n is a positive integer.

NO

Last updated

Was this helpful?