Skip to content

BUG: Panel, MultiIndex, _setitem_with_indexer #5773

Closed
@TomAugspurger

Description

@TomAugspurger

This creates an IndexError.

        idx = MultiIndex.from_tuples([(1, 'one'), (1, 'two'), (2, 'one'),
                                      (2, 'two')])
        df = DataFrame([[1, 'a', 1], [2, 'b', 1], [3, 'c', 1], [4, 'd', 1]],
                       columns=['A', 'B', 'C'], index=idx)
        wp = Panel({'i1': df, 'i2': df})

        wp.loc['i1', (1, 'one'), 'A'] = np.nan

Looks like its just with a Panel with a MultiIndex for one the axes (raises when following take_split_path in core.indexing._setitem_with_indexer)

In [19]: df.index = range(4)

In [20]: df
Out[20]: 
   A  B  C
0  1  a  1
1  2  b  1
2  3  c  1
3  4  d  1

[4 rows x 3 columns]

In [21]: wp = pd.Panel({'i1': df, 'i2': df})

In [22]: wp.loc['i1', 1, 'A'] = 3

In [23]: wp.loc['i1', 1, 'A']
Out[23]: 3  # correct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions