Skip to content

Instantly share code, notes, and snippets.

@saliksyed
Created June 29, 2017 10:47
Show Gist options
  • Save saliksyed/bf0add12ed641627e37480f43fd976a3 to your computer and use it in GitHub Desktop.
Save saliksyed/bf0add12ed641627e37480f43fd976a3 to your computer and use it in GitHub Desktop.
population_data = csv.reader(open("population.dat","r"))
population_by_country_code = {}
for row in population_data:
country = row[0]
country_code = row[1]
population_data = []
for value in row[5:]:
if value == "":
population_data.append(None)
else:
population_data.append(float(value))
country_data = {}
country_data["country"] = country
country_data["country_code"] = country_code
country_data["population_values"] = population_data
population_by_country_code[country_code] = country_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment