lets-plot icon indicating copy to clipboard operation
lets-plot copied to clipboard

DateTime is not recognised in polars.DataFrame

Open OLarionova-HORIS opened this issue 7 months ago • 0 comments

Automatic detection of DateTime series does not work on polars.DataFrame.

Example:

import datetime as dt
import numpy as np
from lets_plot import *

LetsPlot.setup_html()

n = 31
np.random.seed(42)

df = pl.DataFrame({
    'd': [dt.datetime(2021, 1, 1) + dt.timedelta(days=d) for d in range(n)],
    't': np.random.normal(loc=-5, scale=6, size=n)
})

ggplot(df, aes('d', 't')) + geom_bar(stat='identity')

Output: Screenshot 2023-12-13 at 12 41 08

Expected - is the same as the result of using pandas.DataFrame:

ggplot(df.to_pandas(), aes('d', 't')) + geom_bar(stat='identity')
Screenshot 2023-12-13 at 12 48 45

OLarionova-HORIS avatar Dec 13 '23 10:12 OLarionova-HORIS