Run ❯
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
import pandas as pd data1 = { "name": ["Sally", "Mary", "John"], "age": [50, 40, 30] } data2 = { "name": ["Sally", "Peter", "Micky"], "age": [77, 44, 22] } df1 = pd.DataFrame(data1) df2 = pd.DataFrame(data2) newdf = df1.merge(df2, how='right') print(newdf)
name age 0 Sally 77 1 Peter 44 2 Micky 22