Skip to content

csv

CsvDataLoader(path, separator=',')

Bases: Dataset

DataLoader for CSV files.

Initialize the CsvDataLoader.

Parameters:

Name Type Description Default
path str | Path

Path to the CSV file.

required
separator str

Value separator. Defaults to ",".

','
Source code in src/flowcean/environments/csv.py
14
15
16
17
18
19
20
21
22
23
def __init__(self, path: str | Path, separator: str = ",") -> None:
    """Initialize the CsvDataLoader.

    Args:
        path: Path to the CSV file.
        separator: Value separator. Defaults to ",".
    """
    data = pl.read_csv(path, separator=separator)
    data.columns = [column_name.strip() for column_name in data.columns]
    super().__init__(data)