Skip to content

temporian.to_polars #

to_polars(
    evset: EventSet,
    tp_string_to_pl_string: bool = True,
    timestamp_to_datetime: bool = True,
    timestamps: bool = True,
) -> pl.DataFrame

Converts an EventSet to a Polars DataFrame.

Usage example
>>> from datetime import datetime

>>> evset = tp.event_set(
...     timestamps=[datetime(2015, 1, 1), datetime(2015, 1, 2)],
...     features={
...         "feature_1": [0.5, 0.6],
...         "my_index": ["red", "yellow"],
...    },
...    indexes=["my_index"],
... )

>>> df = tp.to_polars(evset)

Parameters:

Name Type Description Default
evset EventSet

Input EventSet.

required
timestamp_to_datetime bool

If true, convert epoch timestamps to Polars Date objects.

True
timestamps bool

If true, include the timestamps as a column in the DataFrame.

True
tp_string_to_pl_string bool

If true, cast Temporian strings to Polars Object.

True

Returns:

Type Description
DataFrame

A Polars DataFrame created from the EventSet.