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
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.
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 9b5d73fd00)
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
Example fix
# before s.rolling_quantile(0.95, window_size=30, weights=w) # nulls -> panic # after s.fill_null(method="forward").rolling_quantile(0.95, window_size=30, weights=w)
Defensive patterns
Strategy: validation
Validate before calling
def safe_rolling_quantile(s: pl.Series, quantile: float, window_size: int,
weights=None, min_periods=1):
if weights is not None and s.null_count() > 0:
raise ValueError("weights + nulls unsupported for rolling_quantile")
return s.rolling_quantile(quantile, window_size, weights=weights, min_periods=min_periods) Try / catch
try:
out = s.rolling_quantile(0.95, window_size=30, weights=w)
except pl.exceptions.PanicException:
out = s.fill_null(method="forward").rolling_quantile(0.95, window_size=30, weights=w) Prevention
- Guard quantile alerting code against null+weights combinations
- Forward-fill monitoring series before weighted percentiles
- Log input null counts alongside rolling metrics for diagnosability
When it happens
Trigger: 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.
Common situations: 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.
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
- Invalid `POLARS_PQ_PREFILTERED_MASK` value '{v}'.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/7ea0a8a07a29f039.
Report an issue: GitHub.