Aggregators#

timeseriesflattener.aggregators#

class Aggregator[source]#

Bases: ABC

name: str#
new_col_name(previous_col_name: str) str[source]#
output_type: type[float | int | bool]#
class CountAggregator[source]#

Bases: Aggregator

Returns the count of non-null values in the look window.

name: str = 'count'#
output_type#

alias of int

class EarliestAggregator(timestamp_col_name: str, name: str = 'earliest')[source]#

Bases: Aggregator

Returns the earliest value in the look window.

name: str#
output_type#

alias of float

timestamp_col_name: str#
class HasValuesAggregator[source]#

Bases: Aggregator

Examines whether any values exist in the look window. If so, returns True, else False.

name: str = 'bool'#
output_type#

alias of bool

class LatestAggregator(timestamp_col_name: str, name: str = 'latest')[source]#

Bases: Aggregator

Returns the latest value in the look window

name: str#
output_type#

alias of float

timestamp_col_name: str#
class MaxAggregator[source]#

Bases: Aggregator

Returns the maximum value in the look window.

name: str = 'max'#
output_type#

alias of float

class MeanAggregator[source]#

Bases: Aggregator

Returns the mean value in the look window.

name: str = 'mean'#
output_type#

alias of float

class MinAggregator[source]#

Bases: Aggregator

Returns the minimum value in the look window.

name: str = 'min'#
output_type#

alias of float

class SlopeAggregator(timestamp_col_name: str, name: str = 'slope')[source]#

Bases: Aggregator

Returns the slope (i.e. the correlation between the timestamp and the value) in the look window.

name: str#
output_type#

alias of float

timestamp_col_name: str#
class SumAggregator[source]#

Bases: Aggregator

Returns the sum of all values in the look window.

name: str = 'sum'#
output_type#

alias of float

class VarianceAggregator[source]#

Bases: Aggregator

Returns the variance of the values in the look window

name: str = 'var'#
output_type#

alias of float

string_to_aggregator(aggregator_name: Literal['bool', 'change_per_day', 'count', 'has_values', 'max', 'mean', 'min', 'slope', 'sum', 'variance'], timestamp_col_name: str) Aggregator[source]#
strings_to_aggregators(aggregator_names: Sequence[Literal['bool', 'change_per_day', 'count', 'has_values', 'max', 'mean', 'min', 'slope', 'sum', 'variance']], timestamp_col_name: str) Sequence[Aggregator][source]#
validate_compatible_fallback_type_for_aggregator(aggregator: Aggregator, fallback: str | int | float | None) None[source]#