time_stream.aggregation.ConditionalCount¶
- class time_stream.aggregation.ConditionalCount(condition)[source]¶
An aggregation class to count values that meet a given condition within each aggregation period.
- Parameters:
condition (Callable[[Expr], Expr])
- __init__(condition)[source]¶
Initialise the conditional count aggregation.
- Parameters:
condition (
Callable[[Expr],Expr]) –A function that takes a Polars expression and returns a boolean expression. .. rubric:: Examples
lambda col: col > 100
lambda col: (col > 10) & (col <= 50)
lambda col: col.is_not_null() & (col > 0)
Methods
__init__(condition)Initialise the conditional count aggregation.
available()Return a sorted list of available registered keys.
expr(ctx, columns)Return the Polars expression for calculating the conditional count in an aggregation period.
get(spec, **kwargs)Resolve spec to an instance of Self:
post_expr(_ctx, _columns)Return additional Polars expressions to be applied after the aggregation.
register(register_cls)A method used as a decorator for subclasses to add to the register by its name attribute.
Attributes
name