1import pandas as pd
2df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'],
3 'value': [1, 2, 3, 5]})
4df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'],
5 'value': [5, 6, 7, 8]})
6df1.merge(df2, left_on='lkey', right_on='rkey')
1>>> df1.merge(df2, left_on='lkey', right_on='rkey')
2 lkey value_x rkey value_y
30 foo 1 foo 5
41 foo 1 foo 8
52 foo 5 foo 5
63 foo 5 foo 8
74 bar 2 bar 6
85 baz 3 baz 7
9