Skip to content

BUG: regression in MultiIndex.isin when index contains NA #48905

Closed
@lukemanley

Description

@lukemanley

Pandas version checks

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

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

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

mi1 = pd.MultiIndex.from_tuples([(1, pd.NA)])
mi2 = pd.MultiIndex.from_tuples([(1, 1), (1, 2)])

mi2.isin(mi1)

Issue Description

output:

array([True, True])    # <- main
array([False, False])  # <- 1.5.0

Regression is on main only and looks to be a result of #48622.

The bug is not in MultiIndex.isin per se, but #48622 looks to have exposed the underlying bug to MultiIndex.isin.

Open PR #48877 will fix the underlying bug.

Expected Behavior

array([False, False])

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMultiIndexRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions