I'm attempting to run an if statement to match the country of origin of marathon winners to theirs countrie's gdp data. I am getting the error 'Can only compare identically-labeled Series objects'.
if df['Winner Country'] == gdp_data['Country']:
if df['YEAR'] == 1970 :
df['gdp'] = gdp_data['1970 gdp/cap']
gdp_data example:
Country 1970 gdp/cap
Kenya 98
df example:
YEAR Winner_Name Winner_Country Time Gender
1977 Dan Cloeter USA 2:17:52 M
I intend to assign a gdp value to df based off both country and year(I only included partial data, there are extra columns for each year in the gdp_data datarame).
Aucun commentaire:
Enregistrer un commentaire