Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Created April 13, 2019 00:40
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