- Google Chrome
- Firefox
- Slack
- Spotify
- Jumpcut or alternative (keeps clipboard history)
- Set up Mail app or Boxy Suite for gmail accounts
- OneNote
license: mit |
license: mit |
license: mit |
license: mit |
import os | |
import pandas as pd | |
import numpy as np | |
from tqdm import tqdm | |
import concurrent.futures as cf | |
from itertools import zip_longest | |
GITHUB = os.environ.get("GITHUB") | |
facilities = pd.read_csv('../data/raw/facilities.csv') |
import os | |
def generate_create_table_statement_from_df(df, schema, tablename, output_path, **kwargs): | |
'''Function to create a PostgreSQL "create table" statement automatically given a pandas dataframe df. | |
Other mandatory inputs: schema, tablename, output_path = absolute path to where you want the "create table" sql file to be placed | |
Optional: primary_key = [list of strings of column name(s) (in order) that define the primary key]''' | |
headers, type_list = generate_headers(df) | |
statement = create_table_sql(schema, tablename, headers, type_list, kwargs.get('primary_key', None)) | |
os.chdir(output_path) |
def distance(origin, destination): | |
'''Haversine distance function to compute distance between 2 lat/long pairs. source: https://gist.github.com/rochacbruno/2883505''' | |
lat1, lon1 = origin | |
lat2, lon2 = destination | |
radius = 3959 # miles | |
dlat = math.radians(lat2 - lat1) | |
dlon = math.radians(lon2 - lon1) | |
a = math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.radians(lat1)) \ | |
* math.cos(math.radians(lat2)) * math.sin(dlon / 2) * math.sin(dlon / 2) |