lets-plot
lets-plot copied to clipboard
DateTime is not recognised in polars.DataFrame
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:
Expected - is the same as the result of using pandas.DataFrame
:
ggplot(df.to_pandas(), aes('d', 't')) + geom_bar(stat='identity')