Skip to content

ENH: add 'dense' ranking method #6333

Closed
@dsm054

Description

@dsm054

scipy.stats.rankdata has five ranking methods: average, min, and max, equivalent to the same options in Series.rank; ordinal, corresponding to our first; but it also has dense:

    'dense':
        Like 'min', but the rank of the next highest element is assigned
        the rank immediately after those assigned to the tied elements.

For example,

>>> scipy.stats.rankdata([3,1,2,1,3], "min")
array([ 4.,  1.,  3.,  1.,  4.])
>>> scipy.stats.rankdata([3,1,2,1,3], "dense")
array([ 3.,  1.,  2.,  1.,  3.])

I've wanted this in the past, and it just showed up on SO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffEnhancementNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions