df1 = pd.DataFrame({'A':[1,2,3],'B':['a','b','c'],'C':['3years','4years','5years']})
df2 = pd.DataFrame({'D':[5,6,7],'B':['a','b','c']})
pd.merge(df1,df2,on='B') # merge the two dataframes by aligning on the column B.
>>
A B C D
0 1 a 3years 5
1 2 b 4years 6
2 3 c 5years 7