Skip to content

fix: exclude missing values from quantileIndex ranks - #287

Open
LucasLeao18 wants to merge 1 commit into
d3:mainfrom
LucasLeao18:fix/quantile-index-missing-rank
Open

LucasLeao18 wants to merge 1 commit into
d3:mainfrom
LucasLeao18:fix/quantile-index-missing-rank

Conversation

@LucasLeao18

Copy link
Copy Markdown

quantileIndex([0, null, 100], 0.5) currently returns 2: missing values are ordered last but still increase the population used to calculate the rank. Filter the index array to defined numeric values before calculating the rank, while retaining original input indices.

Add coverage for null, undefined, NaN, accessors, all-missing input, and medianIndex.

Validation (Node.js 24.15.0, Windows): Both added regression cases fail before the fix. npm test passes: 531 passing, 1 pending, including ESLint.

AI assistance: this contribution was prepared with OpenAI Codex; the change and regression results were reviewed before submission.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant