{"record":{"id":"75435f8debbe0cc4","repo":"pola-rs/polars","slug":"invalid-from-physical-dtype-for","errorCode":null,"errorMessage":"invalid from_physical({dtype:?}) for {:?}","messagePattern":"invalid from_physical\\((.+?)\\) for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/mod.rs","lineNumber":622,"sourceCode":"                self.struct_()\n                    .unwrap()\n                    .from_physical_unchecked(to.as_slice())\n                    .map(|ca| ca.into_series())\n            },\n\n            #[cfg(feature = \"dtype-map\")]\n            (D::List(_), D::Map(_, _)) => {\n                let storage = self.from_physical_unchecked(&dtype.map_storage_dtype().unwrap())?;\n                Ok(MapChunked::from_storage_unchecked(dtype.clone(), storage).into_series())\n            },\n            #[cfg(feature = \"dtype-extension\")]\n            (_, D::Extension(typ, storage)) => {\n                let storage_series = self.from_physical_unchecked(storage.as_ref())?;\n                let ext = ExtensionChunked::from_storage(typ.clone(), storage_series);\n                Ok(ext.into_series())\n            },\n\n            _ => panic!(\"invalid from_physical({dtype:?}) for {:?}\", self.dtype()),\n        }\n    }\n\n    #[cfg(feature = \"dtype-extension\")]\n    pub fn into_extension(self, typ: ExtensionTypeInstance) -> Series {\n        assert!(!self.dtype().is_extension());\n        let ext = ExtensionChunked::from_storage(typ, self);\n        ext.into_series()\n    }\n\n    /// Cast numerical types to f64, and keep floats as is.\n    pub fn to_float(&self) -> PolarsResult<Series> {\n        match self.dtype() {\n            DataType::Float32 | DataType::Float64 => Ok(self.clone()),\n            _ => self.cast_with_options(&DataType::Float64, CastOptions::Overflowing),\n        }\n    }\n","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-core/src/series/mod.rs#L604-L640","documentation":"Series::from_physical_unchecked matches (from_dtype, to_dtype) pairs; the catch-all arm returns this PolarsError when no conversion from the series' physical representation to the requested target dtype is implemented (e.g. an unhandled physical/target pair). Means the requested from_physical cast is not a supported mapping in polars-core.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"invalid from_physical({dtype:?}) for {:?}\". 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 (\"invalid from_physical({dtype:?}) for {:?}\"). 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":["Provide a physical representation that is valid for the logical dtype (e.g. Int32 for Date32).","Cast the physical array to the expected physical type before calling from_physical."],"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"}