Skip to content

dataframe_adapter

DataFrameAdapter(source, input_features, result_path)

Bases: Adapter

Adapter wrapper for a DataFrame.

This class allows to use a DataFrame as an Adapter and an input source for a tool loop. The tool receives data from the source DataFrame row by row. The tool loops results are collected in a result DataFrame which is written to a CSV file at the end of the process.

Source code in src/flowcean/polars/adapter/dataframe_adapter.py
26
27
28
29
30
31
32
33
34
35
36
def __init__(
    self,
    source: DataFrame,
    input_features: Iterable[str],
    result_path: str,
) -> None:
    super().__init__()

    self.df = cast("pl.LazyFrame", source.observe()).select(input_features)
    self.df_len = self.df.select(pl.len()).collect().item()
    self.result_path = result_path