Examples
import numpy as np
import pandas as pd
df1 = pd.DataFrame({'akey': ['s1', 's2', 's3', 's4'],
'value': [2, 3, 4, 5]})
df2 = pd.DataFrame({'bkey': ['s1', 's2', 's3', 's4'],
'value': [6, 7, 8, 9]})
df1
df2
Merge df1 and df2 on the akey and bkey columns. The value columns have the default suffixes, _x and _y, appended.
df1.merge(df2, left_on='akey', right_on='bkey')
Merge DataFrames df1 and df2 with specified left and right suffixes appended to any overlapping columns.
df1.merge(df2, left_on='akey', right_on='bkey',
suffixes=('_left', '_right'))
Merge DataFrames df1 and df2, but raise an exception if the DataFrames have any overlapping columns.