Skip to content

Instantly share code, notes, and snippets.

{
"userCount": 79,
"avgFootprintPerMonth": [
{ "Sep", 6.92 },
{ "Oct", 6.85 },
{ "Nov", 6.79 }
]
}
DROP TABLE IF EXISTS agency;
DROP TABLE IF EXISTS feed_info;
DROP TABLE IF EXISTS stops;
DROP TABLE IF EXISTS routes;
DROP TABLE IF EXISTS calendar;
DROP TABLE IF EXISTS calendar_dates;
DROP TABLE IF EXISTS shapes;
DROP TABLE IF EXISTS trips;
DROP TABLE IF EXISTS stop_times;
DROP TABLE IF EXISTS frequencies;
@sam-drew
sam-drew / mergedatasets.py
Created January 26, 2020 20:17
Script to merge alphabetically sorted Network Rail locations JSON files.
import glob
import json
result = []
for file in glob.glob("*.json"):
with open(file, "r") as inputfile:
result.extend(json.load(inputfile))
with open("TIPLOC_STANOX_LOCs_MERGED.json", "w") as outfile:
{
"header":{
"msg_type":"0003",
"source_dev_id":"VLA5",
"user_id":"#QHPA026",
"original_data_source":"SDR",
"msg_queue_timestamp":"1511528232000",
"source_system_id":"TRUST"
},
"body":{
@sam-drew
sam-drew / ConvertCoordinates.py
Created December 20, 2019 16:01
Convert string coordinates to a coord object.
import json
data = None
extractedData = []
with open("airport-codes_json.json", "r") as read_file:
data = json.load(read_file)
for item in data:
if item["iata_code"] != None and (item["type"] == "large_airport" or item["type"] == "medium_airport"):
@sam-drew
sam-drew / AirportDatasetIATAOnly.py
Last active December 14, 2019 12:20
Extract airports which have an IATA code from the full dataset.
import json
data = None
extractedData = []
with open("airport-codes_json.json", "r") as read_file:
data = json.load(read_file)
for item in data:
if item.iata_code != None: