In [1]:
import pandas as pd
In [2]:
df = pd.DataFrame([[1, 3], [2, 4]], columns=['A', 'B'])
df
Out[2]:
In [3]:
df2 = pd.DataFrame([[1, 5], [1, 6]], columns=['A', 'C'])
df2
Out[3]:
In [4]:
df.merge(df2, how='left', on='A') # merges on columns A
Out[4]:
In [5]:
df2.drop_duplicates(subset=['A'], inplace=True)
In [6]:
df.merge(df2, how='left', on='A')
Out[6]:
In [ ]: