Skip to content

least and greatest should ignore nulls #208

Description

@Fil

d3.least([1, null]) returns null, and d3.greatest([-1, null]) returns null, contrary to the other reducers (such as min, max, median…) which are all skipping nulls.

Interestingly, d3.leastIndex and d3.greatestIndex do not return the same result when using the default and identity accessors (because it follows two different code paths):

d3.leastIndex([1, null]); // 1 [bug]
d3.leastIndex([1, null], d => d); // 0 [correct answer]

This issue is similar to #203.

Activity

  1. self-assigned this
    on Jun 3, 2021
  2. added a commit that references this issue on Jun 3, 2021
    ce1c417
  3. added a commit that references this issue on Jun 5, 2021
    8bef4ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions