Created
June 29, 2017 10:47
-
-
Save saliksyed/bf0add12ed641627e37480f43fd976a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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