Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Created April 13, 2019 00:40

Revisions

  1. StrikingLoo created this gist Apr 13, 2019.
    23 changes: 23 additions & 0 deletions adding_indicators.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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)