Created
July 4, 2017 22:40
-
-
Save saliksyed/0b07d3f3befc860b83a1693a629a356b 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
import json | |
routes = json.loads(open("routes.json").read()) | |
country_to_country_code = json.loads(open("country_name_to_country_code.json").read()) | |
country_code_to_feature = {} | |
for country in routes: | |
if country in country_to_country_code: | |
code = country_to_country_code[country] | |
to_amount = sum(routes[country]["to"].values()) | |
from_amount = sum(routes[country]["from"].values()) | |
country_code_to_feature[code] = [to_amount, from_amount] | |
print country_code_to_feature |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment