{"record":{"id":"eaa6a30dd6c79991","repo":"pola-rs/polars","slug":"expected-float","errorCode":null,"errorMessage":"expected float","messagePattern":"expected float","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs","lineNumber":49,"sourceCode":"        .reduce(min_or_max_fn)\n}\n\npub fn nan_min_s(s: &Series, name: PlSmallStr) -> Series {\n    match s.dtype() {\n        #[cfg(feature = \"dtype-f16\")]\n        DataType::Float16 => {\n            let ca = s.f16().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::min_propagate_nan)])\n        },\n        DataType::Float32 => {\n            let ca = s.f32().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::min_propagate_nan)])\n        },\n        DataType::Float64 => {\n            let ca = s.f64().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::min_propagate_nan)])\n        },\n        _ => panic!(\"expected float\"),\n    }\n}\n\npub fn nan_max_s(s: &Series, name: PlSmallStr) -> Series {\n    match s.dtype() {\n        #[cfg(feature = \"dtype-f16\")]\n        DataType::Float16 => {\n            let ca = s.f16().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::max_propagate_nan)])\n        },\n        DataType::Float32 => {\n            let ca = s.f32().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::max_propagate_nan)])\n        },\n        DataType::Float64 => {\n            let ca = s.f64().unwrap();\n            Series::new(name, [ca_nan_agg(ca, MinMax::max_propagate_nan)])\n        },","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs#L31-L67","documentation":"Panic in the NaN-propagating min/max helpers: the series dtype did not match any float branch (f16/f32/f64), so the s.fNN() downcast returned None. These functions must only be called on float columns; guard the dtype before calling.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"expected float\". 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 (\"expected float\"). 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":["Pass a float-typed column to this NaN-propagating aggregation; integer columns do not have NaNs.","Cast the column to Float64/Float32 before aggregating."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}