{"record":{"id":"30593beaa95d4f8b","repo":"pola-rs/polars","slug":"operation-not-supported-for-dtype","errorCode":null,"errorMessage":"`{}` operation not supported for dtype `{}`","messagePattern":"`(.+?)` operation not supported for dtype `(.+?)`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/mod.rs","lineNumber":10,"sourceCode":"#![allow(unsafe_op_in_unsafe_fn)]\n//! Type agnostic columnar data structure.\nuse crate::chunked_array::flags::StatisticsFlags;\npub use crate::prelude::ChunkCompareEq;\nuse crate::prelude::*;\nuse crate::{HEAD_DEFAULT_LENGTH, TAIL_DEFAULT_LENGTH};\n\nmacro_rules! invalid_operation_panic {\n    ($op:ident, $s:expr) => {\n        panic!(\n            \"`{}` operation not supported for dtype `{}`\",\n            stringify!($op),\n            $s._dtype()\n        )\n    };\n}\n\npub mod amortized_iter;\nmod any_value;\npub mod arithmetic;\npub mod arrow_export;\npub mod builder;\n\nmod comparison;\nmod from;\npub mod implementations;\npub(crate) mod iterator;\npub mod ops;","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-core/src/series/mod.rs#L1-L28","documentation":"The invalid_operation_panic! macro in Series is the generic guard used by numeric accessors (e.g. self.f64(), self.i32()): when code asks a Series for a chunked array of a dtype it does not have (or the operation has no impl for that dtype) it panics naming the operation and dtype. Indicates a dtype/operation mismatch, usually from assuming a column's physical dtype.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"`{}` operation not supported for dtype `{}`\". 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 (\"`{}` operation not supported for dtype `{}`\"). 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":["The operation is not supported for this dtype; cast the series to a supported dtype first.","Check the operation's documentation for supported dtypes and convert accordingly."],"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"}