Skip to content

fix: return NaN from median on empty collections - #254

Merged
dgilland merged 1 commit into
dgilland:developfrom
santhreal:fix/median-empty-nan
Jul 26, 2026
Merged

fix: return NaN from median on empty collections#254
dgilland merged 1 commit into
dgilland:developfrom
santhreal:fix/median-empty-nan

Conversation

@santhreal

@santhreal santhreal commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

pydash.numerical.median hits IndexError when median([]). This PR fixes the regression with a focused test covering the case.

Empty collections took the even-length path and indexed an empty
sorted list (IndexError). Return NaN like mean_by on empty input.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — santhreal:fix/median-empty-nan into dgilland:develop

@dgilland
dgilland merged commit 307b82b into dgilland:develop Jul 26, 2026
12 checks passed
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.

3 participants