PivotTable  type: None#

class lumen.transforms.base.PivotTable(*, aggfunc, columns, index, values, controls, name)#

PivotTable applies pandas.pivot_table` to the data.


Parameters#

aggfunc

type: str
default: 'mean'
Function, list of functions, dict, default ‘mean’

columns

type: Any
default: []
Possible values: ``
Column, Grouper, array, or list of the previousKeys to group by on the pivot table column. If a list is passed,it can contain any of the other types (except list). If an array ispassed, it must be the same length as the data and will be used inthe same manner as column values.

index

type: Any
default: []
Possible values: ``
Column, Grouper, array, or list of the previousKeys to group by on the pivot table index. If a list is passed,it can contain any of the other types (except list). If an array ispassed, it must be the same length as the data and will be used inthe same manner as column values.

values

type: Any
default: []
Possible values: ``
Column or columns to aggregate.


Methods#

PivotTable.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

PivotTable.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