pola-rs/polars · error
activate feature dtype-datetime
Error message
activate feature dtype-datetime
What it means
Series::into_datetime is compiled out when the dtype-datetime feature is disabled; the panic tells the caller to rebuild with the dtype-datetime feature because Datetime dtype support is feature-gated.
Solutions
- Add the feature: polars = { version = "...", features = ["dtype-datetime"] }
- Enable 'temporal', 'lazy', or 'default' feature sets that include dtype-datetime
- Keep timestamps as Int64 epoch values if datetime support is not needed
Example fix
// before
polars = { version = "0.40", default-features = false }
// after
polars = { version = "0.40", default-features = false, features = ["dtype-datetime"] } Defensive patterns
Strategy: validation
Validate before calling
#[cfg(not(feature = "dtype-datetime"))]
compile_error!("polars 'dtype-datetime' feature required"); Try / catch
let s: PolarsResult<Series> = series.strict_cast(&DataType::Datetime(TimeUnit::Ns, None));
Prevention
- Enable dtype-datetime in slim builds that handle timestamps
- Use 'temporal'/'lazy' feature bundles
- Test timestamp paths on the exact feature set used in production
When it happens
Trigger: Calling into_datetime(timeunit, tz) (directly or via finish_cast when casting to Datetime) on a build compiled without dtype-datetime.
Common situations: Minimal polars builds with default-features = false; timestamp reinterpretation in slim or wasm-targeted builds.
Related errors
- activate feature dtype-date
- activate 'product' feature
- into_datetime not implemented for
- not implemented
- {0}
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/dfe2575759f8ba8a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-core/src/series/mod.rs:979
#[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"))]
{
panic!("activate feature dtype-datetime")
}
#[cfg(feature = "dtype-datetime")]
match self.dtype() {
DataType::Int64 => self
.i64()
.unwrap()
.clone()
.into_datetime(timeunit, tz)
.into_series(),
DataType::Datetime(_, _) => self
.datetime()
.unwrap()
.physical()
.clone()
.into_datetime(timeunit, tz)
.into_series(),
dt => panic!("into_datetime not implemented for {dt:?}"),View on GitHub (pinned to fe841f959e)