TimeGroup

time.TimeGroup(self, time_frame, selection, grouping, aggregation)

A kind of TimeStrategy describing a group operation on a time frame, with an optional sub-selection.

Typically you will create one of these by calling methods on a TimeSelection instance.

TimeGroup is a frozen dataclass.

Parameters

time_frame: TimeFrame

The original simulation time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

grouping: TimeGrouping

A method for grouping the time series data.

Attributes

time_frame: TimeFrame

The original time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

grouping: TimeGrouping

A method for grouping the time series data.

group_format

What scale describes the result of the grouping? Are the group keys dates? Simulation ticks? Simulation days? Or some arbitrary other type?

date_bounds: tuple[date, date]

The bounds of the selection, given as the first and last date included.

Methods

Name Description
to_time_frame Creates a TimeFrame that has the same bounds as this TimeStrategy. NOTE: this does not mean the TimeFrame contains the same number of entries (group keys) as the result of applying this strategy – groups can skip days whereas TimeFrames are contiguous.
selection_ticks Converts this into a slice for which ticks are selected (by index).
agg Aggregates the time series using the specified methods.