Skip to content

Keep the correct Series mean after an empty window - #506

Open
AryanRG wants to merge 1 commit into
python-streamz:masterfrom
AryanRG:fix/scalar-series-mean-empty-count
Open

AryanRG wants to merge 1 commit into
python-streamz:masterfrom
AryanRG:fix/scalar-series-mean-empty-count

Conversation

@AryanRG

@AryanRG AryanRG commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

A Series mean counted an empty batch as one observation, so an empty batch followed by 6 could produce a mean of 3. In a window, subtracting the last valid values can also leave rounding error in the running total.

When the valid count reaches zero, reset the running total to zero in its existing type and emit the mean of an empty slice. The next observation then starts with a clean sum, and nullable inputs retain their missing value. The regression covers an empty first batch and recovery after two values of different magnitudes expire.

The dataframe suite recorded 879 passes, 434 skips, 7 expected failures and 96 unexpected passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant