pola-rs/polars · error
weights not yet supported on array with null values
Error message
weights not yet supported on array with null values
What it means
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.
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.
Example fix
// before
df.with_columns(col("x").rolling_median(5, Some(&weights))) // x has nulls
// after
df.with_columns(col("x").fill_null(strategy).rolling_median(5, Some(&weights))) Defensive patterns
Strategy: validation
Validate before calling
if weights.is_some() && arr.null_count() > 0 {
// unsupported: fill nulls or drop weights before rolling_quantile
} Type guard
fn weighted_ok(arr: &dyn Array, weights: Option<&[f64]>) -> bool {
weights.is_none() || arr.null_count() == 0
} Prevention
- Check null_count() before weighted rolling_median/quantile.
- Fill or drop nulls before the call.
- Use unweighted quantiles when nulls must be preserved.
When it happens
Trigger: Calling rolling_quantile (or rolling_median, which delegates to it) with weights=Some(...) on an array with null values.
Common situations: Weighted rolling median/quantile over series containing missing observations.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- weights not yet supported on array with null values
- weights not yet supported on array with null values
- weights not yet supported on array with null values
- weights not yet supported on array with null values
- {0}
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/7ea0a8a07a29f039.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-compute/src/rolling/nulls/quantile.rs:141
params: Option<RollingFnParams>,
) -> ArrayRef
where
T: NativeType
+ IsFloat
+ Float
+ std::iter::Sum
+ AddAssign
+ SubAssign
+ Div<Output = T>
+ NumCast
+ One
+ Zero
+ SealedRolling
+ PartialOrd
+ Sub<Output = T>,
{
if weights.is_some() {
panic!("weights not yet supported on array with null values")
}
let offset_fn = match center {
true => det_offsets_center,
false => det_offsets,
};
/*
TODO: fix or remove the dancing links based rolling implementation
see https://github.com/pola-rs/polars/issues/23480
if !center {
let params = params.as_ref().unwrap();
let RollingFnParams::Quantile(params) = params else {
unreachable!("expected Quantile params");
};
let out = super::quantile_filter::rolling_quantile::<_, MutablePrimitiveArray<_>>(
params.method,
min_periods,
window_size,View on GitHub (pinned to fe841f959e)