Closed DeflateAwning closed 6 months ago
Hi @DeflateAwning, this isn't supported in Polars.
import polars as pl
df = pl.DataFrame({
'id': pl.Series([1, 2, 3]),
'date_min': pl.Series(['2020-01-01', '2021-06-15', '2022-11-01']).cast(pl.Date),
'date_max': pl.Series(['2020-12-01', '2021-12-15', '2023-05-01']).cast(pl.Date)
})
df.with_columns(
pl.date_range(pl.col('date_min'), pl.col('date_max'), '1mo').alias('date')
)
raises
polars.exceptions.ComputeError: `start` must contain exactly one value, got 3 values
Requested this in the upstream project with Python: https://github.com/pola-rs/polars/issues/16084
Perhaps we could leave this issue open and categorize it as waiting until that issue is implemented?
Edit: Opened a new issue to track adding the appropriate pl.date_ranges()
function
Example
Note: haven't tested with the test df exactly yet