MultiIndex is_monotonic_decreasing is incorrect · Issue #16554 · pandas-dev/pandas (original) (raw)

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.