Skip to content

BUG: MultiIndex.is_montonic erronoes when nan in at least one level #37220

Closed
@phofl

Description

@phofl
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

print(pd.MultiIndex.from_tuples([(np.nan, ), (1,)], names=["test"]).is_monotonic_increasing)

Problem description

This returns True, which is obviously not correct. This was introduced by #27495. The error persists with more than one level in the MultiIndex. The example is just for simplicity.

Expected Output

False

Output of pd.show_versions()

master

Metadata

Metadata

Assignees

Labels

MultiIndexRegressionFunctionality that used to work in a prior pandas version

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions