Skip to content

fix: raise ValueError on empty series in divergence stattests - #1924

Open
nisaral wants to merge 1 commit into
evidentlyai:mainfrom
nisaral:fix/stattest-empty-series
Open

fix: raise ValueError on empty series in divergence stattests#1924
nisaral wants to merge 1 commit into
evidentlyai:mainfrom
nisaral:fix/stattest-empty-series

Conversation

@nisaral

@nisaral nisaral commented Sep 8, 2026

Copy link
Copy Markdown

Fixes #1900

Empty reference or current data used to:

  • ZeroDivisionError in PSI / KL / Jensen-Shannon
  • ValueError: min() iterable argument is empty when both series are empty
  • silent (nan, False) from Hellinger

This raises a single ValueError with the series sizes. Zero-bin fill math is unchanged.

Also checks that PSI stays finite when current values sit outside the reference range.

Empty reference/current data used to ZeroDivisionError, crash in min(),
or return (nan, False) from Hellinger. Guard get_binned_data and
Hellinger; keep zero-bin fill math unchanged.

Fixes evidentlyai#1900
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.

Divergence stat tests crash or silently return wrong results on edge case inputs

1 participant