Skip to content

temporian.from_csv #

from_csv(
    path: str,
    timestamps: str = "timestamp",
    indexes: Optional[List[str]] = None,
    sep: str = ",",
) -> EventSet

Reads an EventSet from a CSV file.

Example:
    ```python
    >>> # Example CSV
    >>> temp_file = str(tmp_dir / "temporal_data.csv")
    >>> _ = open(temp_file, "w").write(
    ...     "date,feature_1,feature_2

" ... "2023-01-01,10.0,3.0 " ... "2023-01-02,20.0,4.0 " ... "2023-02-01,30.0,5.0" ... ) >>> # Load CSV >>> evset = tp.from_csv(temp_file, timestamps="date") >>> evset indexes: [] features: [('feature_1', float64), ('feature_2', float64)] events: (3 events): timestamps: ['2023-01-01T00:00:00' '2023-01-02T00:00:00' '2023-02-01T00:00:00'] 'feature_1': [10. 20. 30.] 'feature_2': [3. 4. 5.] ...

    ```

Args:
    path: Path to the file.
    timestamps: Name of the column to be used as timestamps for the
        EventSet.
    indexes: Names of the columns to be used as indexes for the EventSet.
        If None, a flat EventSet will be created.
    sep: Separator to use.

Returns:
    EventSet read from file.