I have 2 data frames - cities and stadiums. I want to merge them
cities
Name Stadium
0 c1 a
1 c2 NaN
2 c3 NaN
3 c4 b
stadiums
Name Capacity Type Col4 Col5
0 a 1 1 1 4
1 b 3 2 2 5
2 c 3 1 1 6
Output:
Name Stadium Capacity Type
0 c1 a 1 1
1 c2 NaN NaN NaN
2 c3 NaN NaN NaN
3 c4 b 3 2
When I merge them with one the following statements, I get additional rows:
cities = pd.merge(cities,stadiums[['Name','Capacity','Type']],left_on='Stadium',right_on='name',how='left')
cities = pd.merge(cities,stadiums[['Name','Capacity','Type']],left_on='Stadium',right_on='name',how='outer')
How do I merge these dataframes?