Returns a function that computes the cumulative aggregate of all values in a single time series.
The cumulative aggregate is calculated progressively for each point in the input time series, considering all preceding points up to and including the current point.
Aggregation functions supported:
Aggregation function | Description |
---|---|
min | Smallest value up to the current point in the time series. |
max | Largest value up to the current point in the time series. |
count | Count of all points up to the current point in the time series. |
sum | Sum of all point values up to the current point. |
product | Product of point values up to the current point. |
mean | Average of all point values up to the current point. |
standard_deviation | Standard deviation of all point values up to the current point. |
difference | Difference between the current point’s value and the first point’s value in the time series, providing the relative change within the series. |
percent_change | Percent change between the current point’s value and the first point’s value in the time series, providing the relative rate of change within the series. |
first | Value of the first point in the time series. |
last | Value of the current (last) point in the time series. |
Column name | Type | Description |
---|---|---|
timestamp | pandas.Timestamp | Timestamp of the point |
value | Union[float, str] | Value of the point |
This function is only applicable to numeric series.
Copied!1 2 3 4 5 6 7 8 9 10 11
>>> series = F.points( ... (2, 10.0), (5, 20.0), (6, 30.0), (7, 40.0), (8, 50.0), (12, 60.0), name="series-1" ... ) >>> series.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000002 10.0 1 1970-01-01 00:00:00.000000005 20.0 2 1970-01-01 00:00:00.000000006 30.0 3 1970-01-01 00:00:00.000000007 40.0 4 1970-01-01 00:00:00.000000008 50.0 5 1970-01-01 00:00:00.000000012 60.0
Copied!1 2 3 4 5 6 7 8 9
>>> cumulative_agg = F.cumulative_aggregate("mean")(series) >>> cumulative_agg.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000002 10.0 1 1970-01-01 00:00:00.000000005 15.0 2 1970-01-01 00:00:00.000000006 20.0 3 1970-01-01 00:00:00.000000007 25.0 4 1970-01-01 00:00:00.000000008 30.0 5 1970-01-01 00:00:00.000000012 35.0