ResetIndex  type: reset_index#

class lumen.transforms.base.ResetIndex(*, col_fill, col_level, drop, level, controls, name)#

ResetIndex resets DataFrame indexes to columns or drops them, see pandas.DataFrame.reset_index

df.reset_index(drop=<drop>, col_fill=<col_fill>, col_level=<col_level>, level=<level>)


Parameters#

col_fill

type: str
default: ''
If the columns have multiple levels, determines how the otherlevels are named. If None then the index name is repeated.

col_level

type: int | str
default: 0
If the columns have multiple levels, determines which level thelabels are inserted into. By default it is inserted into thefirst level.

drop

type: bool
default: False
Do not try to insert index into dataframe columns. This resetsthe index to the default integer index.

level

type: int | str | list
default: None
Only remove the given levels from the index. Removes all levelsby default.


Methods#

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

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