Skip to content

Add TimeSeries.from_polars #2635

Open
Open
@baggiponte

Description

Is your feature request related to a current problem? Please describe.
I was trying to use darts with Polars, but casting a Polars DataFrame into a TimeSeries hardly works.

Describe proposed solution
There are two ways of doing this:

  1. quick and dirty: add a TimeSeries.from_polars classmethod that handles conversion with mostly custom logic (this could potentially entail deprecating from_dataframe and renaming it into from_pandas: it's not the de facto dataframe library anymore).
  2. Use narwhals to rewrite TimeSeries.from_dataframe and support all dataframe backends that narwhals does.

To give a bit of context: narwhals is a new project that's grown a lot this year. It's a very thin, zero-dependency library for developers to write dataframe-agnostic code. It's quite used: plotly 6.0 will use polars for (AFAIK) all its dataframe manipulation, and so do already libraries like altair, marimo, hierarchicalforecast by nixtla...

Glad to provide more details 😊

Metadata

Assignees

No one assigned

    Labels

    feature requestUse this label to request a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions