Skip to content

MultiIndex is_monotonic_decreasing is incorrect #16554

Closed
@TomAugspurger

Description

@TomAugspurger

Or just isn't implemented properly yet?
This MultiIndex is identical on the second level, so its is_monotonic_decreasing should be the same as get_level_values(0).is_monotonic_decreasing (True)

In [27]: idx = pd.MultiIndex([['baz', 'bar'], ['a', 'b']], labels=[[0, 1], [0, 0]])

In [28]: idx
Out[28]:
MultiIndex(levels=[['baz', 'bar'], ['a', 'b']],
           labels=[[0, 1], [0, 0]])

In [29]: idx.is_monotonic_decreasing
Out[29]: False

In [30]: idx.get_level_values(0).is_monotonic_decreasing
Out[30]: True

They should both return True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffMultiIndex

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions