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

BUG: assignment with 0-dim arrays and a multi-index is buggy #7218

Closed
jreback opened this issue May 23, 2014 · 0 comments · Fixed by #7219
Closed

BUG: assignment with 0-dim arrays and a multi-index is buggy #7218

jreback opened this issue May 23, 2014 · 0 comments · Fixed by #7219
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented May 23, 2014

This works in the non-multi-index case, so is a bug
http://stackoverflow.com/questions/23830248/potential-bug-pandas-multiindex-and-0-d-sized-values

np.random.seed(1234)
T = 100 # time
N = 80 # firms
TIndex = np.arange(0, T)
FIndex = np.arange(0, N)

index = pd.MultiIndex.from_product([TIndex, FIndex], names=['time', 'firm'])
df = pd.DataFrame(-999, columns=['A', 'w', 'l', 'a', 'x', 'X', 'd', 'profit'], index=index)
t, n = 0, 2
df.loc[(t,n), 'X'] = np.array(0)
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 MultiIndex
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant