Skip to content

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

Closed
@jreback

Description

@jreback

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions