I'm trying to use the datetime_ranges
function from Polars as shown in their documentation, but I'm running into compilation issues:
According to the docs, this function should be available when using the lazy
and dtype-datetime
features:
pub fn datetime_ranges(
start: Expr,
end: Expr,
interval: Duration,
closed: ClosedWindow,
time_unit: Option<TimeUnit>,
time_zone: Option<TimeZone>,
) -> Expr
Here's my current setup:
// Dependencies in Cargo.toml
polars = {version="0.45.1", features = ["lazy", "dtype-datetime", "parquet", "is_in", "polars-io", "strings", "round_series", "polars-ops", "temporal", "offset_by", "dtype-array","concat_str", "asof_join", "cross_join"]}
// In my code
use polars::lazy::dsl::*;
use polars::prelude::*;
// Trying to use it like this:
let windows: LazyFrame = windows.with_column(datetime_ranges(
col("window_start_min"),
col("window_end_max"),
granularity,
ClosedWindow::Both,
TimeUnit::Milliseconds,
None,
));
However, I'm getting the error:
cannot find function
datetime_ranges
in this scope
And when trying to explicitly import it:
unresolved import
polars::prelude::datetime_ranges
nodatetime_ranges
inprelude
What am I missing here?