Skip to content

BUG/API: assignment of frame in a multi-indexed column frame with a matching level #7655

Closed
@jreback

Description

@jreback

http://stackoverflow.com/questions/24553921/pandas-matching-on-level-of-hierarchical-index/24554350#24554350

This should align on the columns axis. Not clear how to specify the alignment level though (e.g. broadcasting would be tricky here).

import numpy as np
import pandas as pd

arrays = [np.hstack([ ['one']*3, ['two']*3]), ['Dog', 'Bird', 'Cat']*2]
columns = pd.MultiIndex.from_arrays(arrays, names=['foo', 'bar'])

df = pd.DataFrame(np.zeros((3,6)),columns=columns,
                  index=pd.date_range('20000103',periods=3))

df['one'] = pd.DataFrame({'Bird' : np.ones(3)*2,
                          'Dog' : np.ones(3),
                          'Cat' : np.ones(3)*3},
                          index= pd.date_range('20000103',periods=3))
df['two'] = pd.DataFrame({'Dog' : np.ones(3)*4,
                          'Bird' : np.ones(3)*5,
                          'Cat' : np.ones(3)*6,},
                          index= pd.date_range('20000103',periods=3))

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignBugIndexingRelated 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