1# df1 as main df and use the feild from df2 and map it into df1
2
3df1.merge(df2,on='columnName',how='left')
1pd.merge(product,customer,left_on='Product_name',right_on='Purchased_Product')
1import pandas as pd
2
3clients = {'Client_ID': [111,222,333,444,555],
4 'Client_Name': ['Jon Snow','Maria Green', 'Bill Jones','Rick Lee','Pamela Lopez']
5 }
6df1 = pd.DataFrame(clients, columns= ['Client_ID','Client_Name'])
7
8
9countries = {'Client_ID': [111,222,333,444,777],
10 'Client_Country': ['UK','Canada','Spain','China','Brazil']
11 }
12df2 = pd.DataFrame(countries, columns= ['Client_ID', 'Client_Country'])
13
14
15Inner_Join = pd.merge(df1, df2, how='inner', on=['Client_ID', 'Client_ID'])
16print(Inner_Join)
17
1>>> df.join(other.set_index('key'), on='key')
2 key A B
30 K0 A0 B0
41 K1 A1 B1
52 K2 A2 B2
63 K3 A3 NaN
74 K4 A4 NaN
85 K5 A5 NaN
9