Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. def add_indicator_to(dictionary, indicator):
  2. indicator_data = df[df['indicator_name']==indicator]
  3. zipped_values = zip(list(indicator_data['iso3']), list(indicator_data['2017']))
  4. for k, v in zipped_values:
  5. try:
  6. dictionary[k][indicator] = v
  7. except:
  8. print("failed with key: "+k+" on "+indicator)
  9.  
  10. indic = {}
  11. indicators = [
  12. 'Share of seats in parliament (% held by women)',
  13. 'Infants lacking immunization, measles (% of one-year-olds)',
  14. 'Youth unemployment rate (female to male ratio)',
  15. 'Expected years of schooling (years)',
  16. 'Expected years of schooling, female (years)',
  17. 'Expected years of schooling, male (years)',
  18. 'Unemployment, total (% of labour force)',
  19. 'Unemployment, youth (% ages 15–24)',
  20. 'Vulnerable employment (% of total employment)',
  21. ]
  22. for indicator in indicators:
  23. add_indicator_to(indic, indicator)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement