aggregators
This module gathers aggregators
- class Aggregator(in_scales=None, out_scale=None, in_stype=None, out_stype=None)
Bases:
Generic
[I_S
,O_S
],ABC
This abstract class represents a typical aggregator.
- Parameters
in_scales (Union[I_S, Mapping[Any, I_S], None]) – input scales (inferred from input if not provided)
out_scale (Union[O_S, None]) – output scales (inferred from output if not provided)
in_stype (Union[Type[I_S], None]) – input stype (inferred from input if not provided)
out_stype (Union[Type[O_S], None]) – output stype (inferred from output if not provided)
- Raises
TypeError –
if in_scales is not consistent with in_stype (and both are set)
if out_scale is not an instance of out_stype (and both are set)
Note
For all subclasses,
out_scale
is only used as the scale for returned aggregation results.Warning
For all subclasses,
in_scales
is only declarative, and not use for checking/transforming data.- __call__(data: Series, *args, **kwargs) Any
- __call__(data: Values[I_S], *args, **kwargs) Any
- __call__(data: DataFrame, *args, **kwargs) Series
- __call__(data: IValueMatrix[I_S], *args, **kwargs) CommensurableValues[O_S]
- __call__(data: PartialValueMatrix[I_S], *args, **kwargs) AdjacencyValueMatrix[O_S]
Apply aggregation method to input data.
- Parameters
data –
- Returns
aggregation result
Note
aggregation is applied for each row in case of tabular data
- within_in_scales(data)
Check potential input is inside input scales.
- Parameters
data (Union[Series, Values[I_S], DataFrame, IValueMatrix[I_S], PartialValueMatrix[I_S]]) –
- Returns
True
if data is withinin_scales
- Return type
bool