Melt  type: melt#

class lumen.transforms.base.Melt(*, id_vars, ignore_index, value_name, value_vars, var_name, controls, name)#

Melt applies the pandas.melt operation given the id_vars and value_vars.


Parameters#

id_vars

type: Any
default: []
Possible values: ``
Column(s) to use as identifier variables.

ignore_index

type: bool
default: True
If True, original index is ignored. If False, the originalindex is retained. Index labels will be repeated asnecessary.

value_name

type: str
default: 'value'
Name to use for the ‘value’ column.

value_vars

type: Any
default: None
Possible values: ``
Column(s) to unpivot. If not specified, uses all columns thatare not set as id_vars.

var_name

type: str
default: None
Name to use for the ‘variable’ column. If None it usesframe.columns.name or ‘variable’.


Methods#

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

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