Pivot  type: pivot#

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

Pivot applies pandas.DataFrame.pivot given an index, columns, and values.


Parameters#

columns

type: str
default: None
Column to use to make new frame’s columns.

index

type: str
default: None
Column to use to make new frame’s index.If None, uses existing index.

values

type: Any
default: None
Possible values: ``
Column(s) to use for populating new frame’s values.If not specified, all remaining columns will be usedand the result will have hierarchically indexed columns.


Methods#

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

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