Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. population_data = csv.reader(open("population.dat","r"))
  2.  
  3. population_by_country_code = {}
  4. for row in population_data:
  5. country = row[0]
  6. country_code = row[1]
  7. population_data = []
  8. for value in row[5:]:
  9. if value == "":
  10. population_data.append(None)
  11. else:
  12. population_data.append(float(value))
  13. country_data = {}
  14. country_data["country"] = country
  15. country_data["country_code"] = country_code
  16. country_data["population_values"] = population_data
  17. population_by_country_code[country_code] = country_data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement