Aggregate  type: aggregate#

class lumen.transforms.base.Aggregate(*, by, columns, kwargs, method, with_index, controls, name)#

Aggregate one or more columns or indexes, see pandas.DataFrame.groupby.

df.groupby(<by>)[<columns>].<method>()[.reset_index()]


Parameters#

by

type: Any
default: None
Possible values: ``
Columns or indexes to group by.

columns

type: Any
default: None
Possible values: ``
Columns to aggregate.

kwargs

type: dict
default: {}
Keyword arguments to the aggregation method.

method

type: str
default: None
Name of aggregation method.

with_index

type: bool
default: True
Whether to make the groupby columns indexes.


Methods#

Aggregate.apply(table: DataFrame) DataFrame#

Given a table transform it in some way and return it.

Parameters:

table (DataFrame) – The queried table as a DataFrame.

Returns:

A DataFrame containing the transformed data.

Return type:

DataFrame

Aggregate.to_spec(context: Dict[str, Any] | None = None) Dict[str, Any]#

Exports the full specification to reconstruct this component.

Return type:

Resolved and instantiated Component object