{"record":{"id":"7ea0a8a07a29f039","repo":"pola-rs/polars","slug":"weights-not-yet-supported-on-array-with-null-value-7ea0a8","errorCode":null,"errorMessage":"weights not yet supported on array with null values","messagePattern":"weights not yet supported on array with null values","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-compute/src/rolling/nulls/quantile.rs","lineNumber":141,"sourceCode":"    params: Option<RollingFnParams>,\n) -> ArrayRef\nwhere\n    T: NativeType\n        + IsFloat\n        + Float\n        + std::iter::Sum\n        + AddAssign\n        + SubAssign\n        + Div<Output = T>\n        + NumCast\n        + One\n        + Zero\n        + SealedRolling\n        + PartialOrd\n        + Sub<Output = T>,\n{\n    if weights.is_some() {\n        panic!(\"weights not yet supported on array with null values\")\n    }\n    let offset_fn = match center {\n        true => det_offsets_center,\n        false => det_offsets,\n    };\n    /*\n    TODO: fix or remove the dancing links based rolling implementation\n    see https://github.com/pola-rs/polars/issues/23480\n    if !center {\n        let params = params.as_ref().unwrap();\n        let RollingFnParams::Quantile(params) = params else {\n            unreachable!(\"expected Quantile params\");\n        };\n\n        let out = super::quantile_filter::rolling_quantile::<_, MutablePrimitiveArray<_>>(\n            params.method,\n            min_periods,\n            window_size,","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-compute/src/rolling/nulls/quantile.rs#L123-L159","documentation":"Hard guard in the nulls-specialized rolling quantile kernel: it panics immediately when a weights slice is supplied, because the rolling implementation for arrays containing nulls has no weighted variant. Fires only when calling rolling quantile on data with null values while passing weights; drop the weights or fill/drop nulls first.","triggerScenarios":"Calling rolling_quantile (or rolling_median, which delegates to it) with weights=Some(...) on an array with null values.","commonSituations":"Weighted rolling median/quantile over series containing missing observations.","solutions":["Fill or drop nulls before applying the weighted rolling quantile.","Use unweighted rolling_quantile/rolling_median (omit weights) on the null-containing column.","Interpolate nulls prior to the call."],"exampleFix":"// before\ndf.with_columns(col(\"x\").rolling_median(5, Some(&weights))) // x has nulls\n// after\ndf.with_columns(col(\"x\").fill_null(strategy).rolling_median(5, Some(&weights)))","handlingStrategy":"validation","validationCode":"if weights.is_some() && arr.null_count() > 0 {\n    // unsupported: fill nulls or drop weights before rolling_quantile\n}","typeGuard":"fn weighted_ok(arr: &dyn Array, weights: Option<&[f64]>) -> bool {\n    weights.is_none() || arr.null_count() == 0\n}","tryCatchPattern":null,"preventionTips":["Check null_count() before weighted rolling_median/quantile.","Fill or drop nulls before the call.","Use unweighted quantiles when nulls must be preserved."],"tags":["rust","polars","rolling","nulls","weights"],"backgroundTag":"unsupported-operation","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}