Skip to content

Should internal usages of sorting with numpy use kind="stable"? #53558

Open
@mroeschke

Description

@mroeschke

There are several places where we call np.sort/argsort/etc. internally, i.e. not cases where users can specify a sorting kind like in sort_values, and use the default unstable kind="quicksort"

In numpy 1.25, it appears that CPUs that can use AVX will have a modified quicksort and recently broke some tests xref #53548 in our numpy dev build where we were testing these unstable sorting results.

Is it worth transitioning to a stable sorting algorithm internally for consistency?

Alternatively we could dynamically transition to use a stable sorting algorithm if duplicate values are being sorted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions