HistoryTransform  type: history#

class lumen.transforms.base.HistoryTransform(*, date_column, length, controls, name)#

HistoryTransform accumulates a history of the queried data.

The internal buffer accumulates data up to the supplied length and (optionally) adds a date_column to the data.


Parameters#

date_column

type: Any
default: None
Possible values: ``
If defined adds a date column with the supplied name.

length

type: int
default: 10
bounds: (1, None)
Accumulates a history of data.


Methods#

HistoryTransform.apply(table: DataFrame) DataFrame#

Accumulates a history of the data in a buffer up to the declared length and optionally adds the current datetime to the declared date_column.

Parameters:

data (DataFrame) – The queried table as a DataFrame.

Returns:

A DataFrame containing the buffered history of the data.

Return type:

DataFrame

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