TimeFrame.aggregate

TimeFrame.aggregate(aggregation_period, aggregation_function, columns=None, missing_criteria=None, aggregation_time_anchor=None)[source]

Apply an aggregation function to a column in this TimeFrame, check the aggregation satisfies user requirements and return a new derived TimeFrame containing the aggregated data.

Parameters:
  • aggregation_period (Period | str) – The period over which to aggregate the data

  • aggregation_function (Union[str, Type[AggregationFunction], AggregationFunction]) – The aggregation function to apply

  • columns (str | list[str] | None) – The column(s) containing the data to be aggregated. If omitted, will use all data columns.

  • missing_criteria (tuple[str, float | int] | None) – How the aggregation handles missing data

  • aggregation_time_anchor (TimeAnchor | None) – The time anchor for the aggregation result.

Return type:

Self

Returns:

A TimeFrame containing the aggregated data.