Skip to content

Breakage when setting MultiIndex with a mutable sequence #2200

@ghost

Description

import pandas as pd
df=pd.DataFrame({"a":[1,2,3],"b":[4,5,6],"c":[7,8,9]}).set_index(["a","b"])
l=list(df.index)
l[0]=("faz","boo")
df.index=l
print df
# all good
l[0]=["faz","boo"]
df.index=l
print df
# badness

If this acceptable usage and index entries must be immutable, failing early would be good.

Note: If you get an UnboundLocalError Exception, That's an un-related issue, PR fix as soon
as travis is green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions