I have two dataframe:
import pandas as pd
create the first data frame
df1
id name
0 1 John
1 2 Mary
2 3 David
3 4 Lisa
df2
id age
0 2 35
1 44 28
2 11 42
3 3 19
I was trying to get values of 'name' column in df1 replaced by values of 'age' column of df2 but only where id has common values. I am trying to get this output
id name
0 1 John
1 2 35
2 3 19
3 4 Lisa