{"record":{"id":"8c7460347ecb3872","repo":"pola-rs/polars","slug":"into-duration-not-implemented-for-dt","errorCode":null,"errorMessage":"into_duration not implemented for {dt:?}","messagePattern":"into_duration not implemented for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/mod.rs","lineNumber":1009,"sourceCode":"        {\n            panic!(\"activate feature dtype-duration\")\n        }\n        #[cfg(feature = \"dtype-duration\")]\n        match self.dtype() {\n            DataType::Int64 => self\n                .i64()\n                .unwrap()\n                .clone()\n                .into_duration(timeunit)\n                .into_series(),\n            DataType::Duration(_) => self\n                .duration()\n                .unwrap()\n                .physical()\n                .clone()\n                .into_duration(timeunit)\n                .into_series(),\n            dt => panic!(\"into_duration not implemented for {dt:?}\"),\n        }\n    }\n\n    // used for formatting\n    pub fn str_value(&self, index: usize) -> PolarsResult<Cow<'_, str>> {\n        Ok(self.0.get(index)?.str_value())\n    }\n    /// Get the head of the Series.\n    pub fn head(&self, length: Option<usize>) -> Series {\n        let len = length.unwrap_or(HEAD_DEFAULT_LENGTH);\n        self.slice(0, std::cmp::min(len, self.len()))\n    }\n\n    /// Get the tail of the Series.\n    pub fn tail(&self, length: Option<usize>) -> Series {\n        let len = length.unwrap_or(TAIL_DEFAULT_LENGTH);\n        let len = std::cmp::min(len, self.len());\n        self.slice(-(len as i64), len)","sourceCodeStart":991,"sourceCodeEnd":1027,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-core/src/series/mod.rs#L991-L1027","documentation":"Series::into_duration (feature enabled) converts only Int64 physical values and Duration series; other dtypes fall through to this panic naming the dtype. Cast the series to Int64 (the physical duration representation) before calling into_duration.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"into_duration not implemented for {dt:?}\". 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.","commonSituations":"Encountered when input data or configuration does not meet the preconditions of the throwing code path (\"into_duration not implemented for {dt:?}\"). 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.","solutions":["Convert to Duration only from supported dtypes (Datetime differences, Int64).","Cast the source to Int64 with the desired time unit first."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}