Skip to content

ENH: make sorting algorithm options to value_counts and record it in the docs #63155

@cmp0xff

Description

@cmp0xff

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

In the dev documentation, it is not clear which sorting algorithm is used by value_counts, which is also fixed.

It would be helpful to make such an option and record it in the docs.

Feature Description

We can follow the example of sort_values, adding the parameter kind:

import pandas as pd

s = pd.Series([1, 1, 1, 2, 2, 2]).value_counts(kind="stable")

Alternative Solutions

We can just record in the docs that the algo is fixed to quicksort.

Additional Context

Related to #63154 and numpy/numpy#30262. As a user I would like to know that the sorting result is deterministic and optionally stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffEnhancementSortinge.g. sort_index, sort_values

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions