Skip to content
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

Can't assign to subsets of MultiIndex columns DataFrames using partial labels #1803

Closed
sadruddin opened this issue Aug 22, 2012 · 0 comments
Closed
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@sadruddin
Copy link

Assigning a value (scalar or Series) to the subset of a dataframe with MultiIndex columns addressed by a partial label doesn't work.

df = pandas.DataFrame(index=[1, 3, 5], columns=pandas.MultiIndex.from_tuples([('A', '1'), ('A', '2'), ('B', '1')]))
df['A'] = 0.0 # Doesn't work
df['A'] = df['B', '1'] # Works, but adds a column instead of updating the two existing ones

df2 = df.T.copy()
df2.ix['A'] = 0.0 # Works
df2.ix['A'] = df2['B', '1'] # Works

The same thing in the rows dimension works as expected.

@wesm wesm closed this as completed in 6abbbc1 Dec 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

2 participants