Skip to content

BUG: merge_ordered gets unexpected left join result #38166

Closed
@GYHHAHA

Description

@GYHHAHA
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


>>>l = pd.DataFrame([['g', 'h', 1], ['g', 'h', 3]], columns=list('GHT'))
>>>l
   G  H  T
0  g  h  1
1  g  h  3
>>>r = pd.DataFrame([[2, 1]], columns=list('TE'))
>>>r
   T  E
0  2  1

results

>>>pd.merge_ordered(l, r, on='T', left_by=['G'])
G H T E
0 g h 1 nan
1 g h 3 nan

expected

>>>pd.merge_ordered(l, r, on='T', left_by=['G'])
G H T E
0 g h 1 nan
1 g h 2 1
2 g h 3 nan

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions