{"record":{"id":"1c7882c913d6a428","repo":"pola-rs/polars","slug":"into-decimal-precision-scale-not-implement","errorCode":null,"errorMessage":"into_decimal({precision:?}, {scale}) not implemented for {dt:?}","messagePattern":"into_decimal\\((.+?), (.+?)\\) not implemented for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/mod.rs","lineNumber":924,"sourceCode":"    pub fn strict_cast(&self, dtype: &DataType) -> PolarsResult<Series> {\n        self.cast_with_options(dtype, CastOptions::Strict)\n    }\n\n    #[cfg(feature = \"dtype-decimal\")]\n    pub fn into_decimal(self, precision: usize, scale: usize) -> PolarsResult<Series> {\n        match self.dtype() {\n            DataType::Int128 => Ok(self\n                .i128()\n                .unwrap()\n                .clone()\n                .into_decimal(precision, scale)?\n                .into_series()),\n            DataType::Decimal(cur_prec, cur_scale)\n                if scale == *cur_scale && precision >= *cur_prec =>\n            {\n                Ok(self)\n            },\n            dt => panic!(\"into_decimal({precision:?}, {scale}) not implemented for {dt:?}\"),\n        }\n    }\n\n    #[cfg(feature = \"dtype-time\")]\n    pub fn into_time(self) -> Series {\n        match self.dtype() {\n            DataType::Int64 => self.i64().unwrap().clone().into_time().into_series(),\n            DataType::Time => self\n                .time()\n                .unwrap()\n                .physical()\n                .clone()\n                .into_time()\n                .into_series(),\n            dt => panic!(\"date not implemented for {dt:?}\"),\n        }\n    }\n","sourceCodeStart":906,"sourceCodeEnd":942,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-core/src/series/mod.rs#L906-L942","documentation":"Series::into_decimal only converts Int128 and already-decimal series with compatible precision/scale; any other dtype reaches the terminal panic arm naming the actual dtype. Fires when calling into_decimal on e.g. a Float64 or String series instead of first casting to an integer type.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"into_decimal({precision:?}, {scale}) 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_decimal({precision:?}, {scale}) 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 the series to Decimal only from supported numeric dtypes; cast to Int128/Float first if available.","Scale the values to integers and attach the decimal metadata manually."],"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-14T05:17:10.506Z"}