Skip to content

Instantly share code, notes, and snippets.

View saliksyed's full-sized avatar

Salik Syed saliksyed

  • California
View GitHub Profile
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 00:19:18 2017
@author: saliksyed
"""
import json
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:
{"AGO": 25021974.0, "DZA": 39666519.0, "EGY": 91508084.0, "BGD": 160995642.0, "NER": 19899120.0, "LIC": 638286288.0, "MIC": 5521326690.68203, "NAM": 2458830.0, "VEN": 31108083.0, "BGR": 7177991.0, "BOL": 10724705.0, "GHA": 27409893.0, "PAK": 188924874.0, "WLD": 7346705902.68203, "CPV": 520502.0, "PRE": 850210773.0, "ROU": 19815308.0, "JOR": 7594547.0, "LBR": 4503438.0, "MUS": 1262605.0, "LBY": 6278438.0, "MYS": 30331007.0, "PRI": 3474182.0, "SXM": 38824.0, "PRK": 25155317.0, "PSE": 4422143.0, "TZA": 53470420.0, "BWA": 2262485.0, "KHM": 15577899.0, "NIC": 6082032.0, "SAS": 1744161298.0, "PRY": 6639123.0, "HKG": 7305700.0, "SAU": 31540372.0, "LBN": 5850743.0, "SVN": 2063531.0, "BFA": 18105570.0, "CHE": 8281430.0, "LMY": 6159612978.68203, "MRT": 4067564.0, "CHI": 163692.0, "HRV": 4203604.0, "CHL": 17948141.0, "CHN": 1371220000.0, "KNA": 55572.0, "SLE": 6453184.0, "JAM": 2793335.0, "SMR": 31781.0, "GIB": 32217.0, "DJI": 887861.0, "GIN": 12608590.0, "FIN": 5479531.0, "URY": 3431555.0, "OED": 1282900953.0, "SYC": 9
{"Canada": "CAN", "Sao Tome and Principe": "STP", "Turkmenistan": "TKM", "Lithuania": "LTU", "Cambodia": "KHM", "Ethiopia": "ETH", "Swaziland": "SWZ", "Argentina": "ARG", "Bolivia": "BOL", "Cameroon": "CMR", "Burkina Faso": "BFA", "Ghana": "GHA", "Saudi Arabia": "SAU", "American Samoa": "ASM", "Northern Mariana Islands": "MNP", "Slovenia": "SVN", "Guatemala": "GTM", "Bosnia and Herzegovina": "BIH", "Kuwait": "KWT", "Germany": "DEU", "Dominica": "DMA", "Liberia": "LBR", "Maldives": "MDV", "Pakistan": "PAK", "Oman": "OMN", "Tanzania": "TZA", "Greenland": "GRL", "Gabon": "GAB", "Finland": "FIN", "New Zealand": "NZL", "Jamaica": "JAM", "Albania": "ALB", "Samoa": "WSM", "United Arab Emirates": "ARE", "Guam": "GUM", "India": "IND", "Azerbaijan": "AZE", "Lesotho": "LSO", "Kenya": "KEN", "Tajikistan": "TJK", "Turkey": "TUR", "Afghanistan": "AFG", "Bangladesh": "BGD", "Mauritania": "MRT", "Solomon Islands": "SLB", "Turks and Caicos Islands": "TCA", "Mongolia": "MNG", "France": "FRA", "Bermuda": "BMU", "Somalia": "SOM"
{"AGO": 103919917621.964, "DZA": 189772334939.869, "EGY": 247720276693.405, "BGD": 156629549345.307, "NER": 7637893798.43719, "LIC": 371321680885.918, "MIC": 25676306817301.2, "NAM": 14753072612.5139, "VEN": null, "BGR": 54639046566.9725, "BOL": 25661705333.9681, "GHA": 46504846805.2194, "PAK": 215894314582.495, "WLD": 75241687973546.0, "CPV": 1821863561.39155, "PRE": 1261538890478.77, "ROU": 189015691035.79, "JOR": 30196245380.2547, "LBR": 1653502629.68398, "MUS": 11955531875.5762, "LBY": null, "MYS": 329952500698.519, "PRI": null, "SXM": null, "PRK": null, "PSE": 11714141339.3703, "TZA": 43728244107.3269, "BWA": 16018663549.7678, "KHM": 15903594933.6638, "NIC": 11245854069.4099, "SAS": 2790256798647.21, "PRY": 25380441836.5719, "HKG": 264271404106.356, "SAU": 672213866666.667, "LBN": 41221372225.8043, "SVN": 49073433774.8344, "BFA": 11671015481.2691, "CHE": 625927491897.594, "LMY": 26047871898643.4, "MRT": null, "CHI": null, "HRV": 58327812720.5909, "CHL": 263128816886.736, "CHN": 8909811544022.38, "KNA": 8
import json
import numpy as np
import matplotlib.pyplot as plt
graph_data = json.loads(open("routes.json").read())
totals = {}
for start_country in graph_data:
data = graph_data[start_country]
import json
import numpy as np
import matplotlib.pyplot as plt
graph_data = json.loads(open("routes.json").read())
belgium_count = []
switzerland_count = []
{"Canada": {"to": {"Canada": 1151, "Brazil": 2, "Italy": 8, "Peru": 1, "Saint Lucia": 2, "Costa Rica": 3, "Saint Pierre and Miquelon": 3, "France": 19, "Bahamas": 3, "Bermuda": 2, "Aruba": 2, "Ireland": 3, "Israel": 3, "Australia": 1, "Algeria": 1, "Cuba": 29, "El Salvador": 1, "Iceland": 2, "Belgium": 7, "Jordan": 3, "Chile": 1, "Puerto Rico": 1, "Netherlands Antilles": 1, "China": 15, "Dominican Republic": 17, "Germany": 19, "Hong Kong": 4, "Panama": 1, "Spain": 4, "Netherlands": 10, "Jamaica": 12, "Mexico": 30, "Denmark": 3, "Poland": 2, "Martinique": 1, "Saudi Arabia": 1, "Turkey": 2, "United States": 364, "Trinidad and Tobago": 2, "South Korea": 4, "Guyana": 2, "Switzerland": 8, "Grenada": 2, "Guadeloupe": 1, "Russia": 2, "Pakistan": 3, "Philippines": 1, "Portugal": 8, "Cayman Islands": 2, "Morocco": 1, "Egypt": 1, "United Arab Emirates": 3, "Haiti": 1, "United Kingdom": 42, "Austria": 3, "Antigua and Barbuda": 2, "Colombia": 2, "Greece": 2, "Japan": 10, "Taiwan": 3, "Turks and Caicos Islands": 3, "Barba
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 29 11:26:56 2017
@author: saliksyed
"""
import csv
import matplotlib.pyplot as plt
from flask import Flask, make_response
app = Flask(__name__)
import matplotlib.pyplot as plt
def draw_picture():
# Open the file with all the airports and read every line
data = open("airports.dat", "r").readlines()