pola-rs/polars · error
activate feature dtype-date
Error message
activate feature dtype-date
What it means
Series::into_date is compiled out when the dtype-date feature is disabled; calling it panics with a reminder to rebuild polars with the dtype-date feature enabled, since Date dtype support is feature-gated.
Solutions
- Add the feature: polars = { version = "...", features = ["dtype-date"] }
- Enable 'temporal' or 'default' feature sets which include dtype-date
- Keep the column as Int32 and do date math manually if you must stay feature-slim
Example fix
// before
polars = { version = "0.40", default-features = false }
// after
polars = { version = "0.40", default-features = false, features = ["dtype-date"] } Defensive patterns
Strategy: validation
Validate before calling
#[cfg(not(feature = "dtype-date"))]
compile_error!("polars 'dtype-date' feature required"); Try / catch
let d: PolarsResult<Series> = series.strict_cast(&DataType::Date);
Prevention
- List dtype-date explicitly when using default-features = false
- Enable 'temporal' bundle for date/time/datetime features
- Compile-check feature combos in CI
When it happens
Trigger: Calling into_date() (directly or via finish_cast when casting to Date) on a build compiled without the dtype-date feature.
Common situations: Minimal polars builds with default-features = false; casting Int32 day-since-epoch columns to Date in a slim build.
Related errors
- activate feature dtype-datetime
- activate 'product' feature
- {0}
- activate dtype
- activate dtype-categorical to convert dictionary arrays
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/4335c26994433273.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-core/src/series/mod.rs:959
#[cfg(feature = "dtype-time")]
pub fn into_time(self) -> Series {
match self.dtype() {
DataType::Int64 => self.i64().unwrap().clone().into_time().into_series(),
DataType::Time => self
.time()
.unwrap()
.physical()
.clone()
.into_time()
.into_series(),
dt => panic!("date not implemented for {dt:?}"),
}
}
pub fn into_date(self) -> Series {
#[cfg(not(feature = "dtype-date"))]
{
panic!("activate feature dtype-date")
}
#[cfg(feature = "dtype-date")]
match self.dtype() {
DataType::Int32 => self.i32().unwrap().clone().into_date().into_series(),
DataType::Date => self
.date()
.unwrap()
.physical()
.clone()
.into_date()
.into_series(),
dt => panic!("date not implemented for {dt:?}"),
}
}
#[allow(unused_variables)]
pub fn into_datetime(self, timeunit: TimeUnit, tz: Option<TimeZone>) -> Series {
#[cfg(not(feature = "dtype-datetime"))]View on GitHub (pinned to fe841f959e)