Created
April 13, 2019 00:40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_indicator_to(dictionary, indicator): | |
indicator_data = df[df['indicator_name']==indicator] | |
zipped_values = zip(list(indicator_data['iso3']), list(indicator_data['2017'])) | |
for k, v in zipped_values: | |
try: | |
dictionary[k][indicator] = v | |
except: | |
print("failed with key: "+k+" on "+indicator) | |
indic = {} | |
indicators = [ | |
'Share of seats in parliament (% held by women)', | |
'Infants lacking immunization, measles (% of one-year-olds)', | |
'Youth unemployment rate (female to male ratio)', | |
'Expected years of schooling (years)', | |
'Expected years of schooling, female (years)', | |
'Expected years of schooling, male (years)', | |
'Unemployment, total (% of labour force)', | |
'Unemployment, youth (% ages 15–24)', | |
'Vulnerable employment (% of total employment)', | |
] | |
for indicator in indicators: | |
add_indicator_to(indic, indicator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment