pola-rs/polars · error
activate feature dtype-duration
Error message
activate feature dtype-duration
What it means
Series::into_duration is gated behind the 'dtype-duration' cargo feature; without it the function panics with this message at call time. A build-configuration error resolved by enabling the feature when compiling polars.
Source
Thrown at crates/polars-core/src/series/mod.rs:992
.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:?}"),
}
}
#[allow(unused_variables)]
pub fn into_duration(self, timeunit: TimeUnit) -> Series {
#[cfg(not(feature = "dtype-duration"))]
{
panic!("activate feature dtype-duration")
}
#[cfg(feature = "dtype-duration")]
match self.dtype() {
DataType::Int64 => self
.i64()
.unwrap()
.clone()
.into_duration(timeunit)
.into_series(),
DataType::Duration(_) => self
.duration()
.unwrap()
.physical()
.clone()
.into_duration(timeunit)
.into_series(),
dt => panic!("into_duration not implemented for {dt:?}"),
}View on GitHub (pinned to 68506541d2)
Solutions
- Enable the `dtype-duration` cargo feature to use Duration dtype.
- Represent durations as Int64 in a fixed time unit if the feature cannot be enabled.
Defensive patterns
Strategy: fallback
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "activate feature dtype-duration". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("activate feature dtype-duration"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/c538dab15cf4075d.
Report an issue: GitHub.