Skip to content

BUG: iloc getitem with DataFrame with MultiIndex #5528

Closed
@zhangruoyu

Description

@zhangruoyu
import pandas as pd
import numpy as np

tup = zip(*[['a','a','b','b'],['x','y','x','y']])
index = pd.MultiIndex.from_tuples(tup)
df = pd.DataFrame(np.random.randn(4, 4), index=index)
df.iloc[[0, 1]]

This will raise:

ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'

I am using 0.12 version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions