{"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/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-compute/src/rolling/nulls/quantile.rs#L123-L159","documentation":"nulls::rolling_quantile (the null-handling rolling quantile/percentile kernel) guards against combining weights with nulls: if weights is Some(_) it panics 'weights not yet supported on array with null values'. Weighted quantiles on the null path are unimplemented; the comment in the source also notes the dancing-links implementation is disabled pending a fix.","triggerScenarios":"s.rolling_quantile(quantile=0.9, window_size=k, weights=[...]) on a Series with at least one null; rolling median/percentile with exponential decay weights over nullable metrics.","commonSituations":"Monitoring/SLO pipelines computing weighted rolling p95 over series with missing samples; quantile alerting that works on healthy data and panics during partial outages when nulls appear.","solutions":["Drop the weights argument for nullable input - unweighted rolling quantile is supported","Fill nulls first and accept the statistical impact: s.fill_null(...).rolling_quantile(..., weights=...)","Compute on drop_nulls() and reindex where window alignment can be restored","Request weighted null-aware quantiles upstream"],"exampleFix":"# before\ns.rolling_quantile(0.95, window_size=30, weights=w)  # nulls -> panic\n# after\ns.fill_null(method=\"forward\").rolling_quantile(0.95, window_size=30, weights=w)","handlingStrategy":"validation","validationCode":"def safe_rolling_quantile(s: pl.Series, quantile: float, window_size: int,\n                           weights=None, min_periods=1):\n    if weights is not None and s.null_count() > 0:\n        raise ValueError(\"weights + nulls unsupported for rolling_quantile\")\n    return s.rolling_quantile(quantile, window_size, weights=weights, min_periods=min_periods)","typeGuard":null,"tryCatchPattern":"try:\n    out = s.rolling_quantile(0.95, window_size=30, weights=w)\nexcept pl.exceptions.PanicException:\n    out = s.fill_null(method=\"forward\").rolling_quantile(0.95, window_size=30, weights=w)","preventionTips":["Guard quantile alerting code against null+weights combinations","Forward-fill monitoring series before weighted percentiles","Log input null counts alongside rolling metrics for diagnosability"],"tags":["polars","rolling","rolling-quantile","weights","null-values","panic"],"backgroundTag":"rolling-weights-with-nulls","analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}