Skip to content

align with broadcast_axis specified always uses inner join when aligning dataframe and series on other axis. #13194

Open
@kdebrab

Description

@kdebrab

Pandas version 0.18.1:

In[1]: import pandas as pd
In[2]: df = pd.DataFrame(np.array([[1., 2.], [3., 4.]]), columns=list('AB'))
In[3]: ts = pd.Series([5., 6., 7.])
In[4]: df.align(ts, join='outer', axis=0, broadcast_axis=1)
Out[4]: 
(     A    B
 0  1.0  2.0
 1  3.0  4.0,      A    B
 0  5.0  5.0
 1  6.0  6.0)

However, as 'join' is specified to be 'outer', I would have expected the following result:

Out[4]: 
(     A    B
 0  1.0  2.0
 1  3.0  4.0
 2  NaN  NaN,      A    B
 0  5.0  5.0
 1  6.0  6.0
 2  7.0  7.0
 dtype: float64)

Same problem occurs for:

df.align(ts, join='right', axis=0, broadcast_axis=1)
ts.align(df, join='outer', axis=0, broadcast_axis=1)
ts.align(df, join='left', axis=0, broadcast_axis=1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions