Skip to content

Instantly share code, notes, and snippets.

@lmeulen
Created May 5, 2021 19:31
Show Gist options
  • Save lmeulen/8373cdfc374678b80aad00d4c252d182 to your computer and use it in GitHub Desktop.
Save lmeulen/8373cdfc374678b80aad00d4c252d182 to your computer and use it in GitHub Desktop.
traveltime_getdata
import pandas as pd
import geopandas as gpd
import numpy as np
import os, urllib, json, csv, zipfile, math
INPUT='input_ut.csv'
OUTPUT='output_ut.csv'
OUTPUT_PC='distances_pc4_ut.json'
with zipfile.Zipfile('gtfs-nl.zip') as z:
with z.open('stops.txt') as f:
df = pd.read_csv(f)
df = df[['stop_lat', 'stop_lon']]
df.stop_lat = df.stop_lat.round(2)
df.stop_lon = df.stop_lon.round(2)
df['Date'] = '03/17/2021'
df['Time'] = '04:00PM'
df['start_lat'] = '52.088208'
df['start_lon'] = '5.113234'
df = df[['Date', 'Time', 'start_lat', 'start_lon', 'stop_lat', 'stop_lon']]
df = df.drop_duplicates()
df.to_csv(INPUT, index=False)
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment