Skip to content

Instantly share code, notes, and snippets.

@saliksyed
Created July 4, 2017 22:40
Show Gist options
  • Save saliksyed/0b07d3f3befc860b83a1693a629a356b to your computer and use it in GitHub Desktop.
Save saliksyed/0b07d3f3befc860b83a1693a629a356b to your computer and use it in GitHub Desktop.
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