SetIndex  type: set_index#

class lumen.transforms.base.SetIndex(*, append, drop, keys, verify_integrity, controls, name)#

SetIndex promotes DataFrame columns to indexes, see pandas.DataFrame.set_index.

df.set_index(<keys>, drop=<drop>, append=<append>, verify_integrity=<verify_integrity>)


Parameters#

append

type: bool
default: False
Whether to append columns to existing index.

drop

type: bool
default: True
Delete columns to be used as the new index.

keys

type: str | list
default: None
This parameter can be either a single column key or a listcontaining column keys.

verify_integrity

type: bool
default: False
Check the new index for duplicates. Otherwise defer the checkuntil necessary. Setting to False will improve the performanceof this method.


Methods#

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

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