Skip to content

BUG: MultiIndex.putmask #43212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbrockmendel opened this issue Aug 25, 2021 · 1 comment · Fixed by #43219
Closed

BUG: MultiIndex.putmask #43212

jbrockmendel opened this issue Aug 25, 2021 · 1 comment · Fixed by #43219
Milestone

Comments

@jbrockmendel
Copy link
Member

left = pd.MultiIndex.from_tuples([(np.nan, 6), (np.nan, 6), ("a", 4)])
right = pd.MultiIndex.from_tuples([("a", 1), ("a", 1), ("d", 1)])
mask = np.array([True, True, False])

result = left.putmask(mask, right)
>>> result
[...]
IndexError: list index out of range

The result here somehow ended up with len(result.levels) == 0

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 25, 2021
@simonjayhawkins
Copy link
Member

on 1.2.5 this raises TypeError: Expected tuple, got MultiIndex

@simonjayhawkins simonjayhawkins added MultiIndex and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 25, 2021
@jreback jreback added this to the 1.4 milestone Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants