Skip to content

Instantly share code, notes, and snippets.

View r-shekhar's full-sized avatar

Ravi Shekhar r-shekhar

View GitHub Profile
@r-shekhar
r-shekhar / assign.py
Created June 1, 2017 23:41
Assign Taxi Zones Snippet
def assign_taxi_zones(df, lon_var, lat_var, locid_var):
"""Joins DataFrame with Taxi Zones shapefile.
This function takes longitude values provided by `lon_var`, and latitude
values provided by `lat_var` in DataFrame `df`, and performs a spatial join
with the NYC taxi_zones shapefile.
The shapefile is hard coded in, as this function makes a hard assumption of
latitude and longitude coordinates. It also assumes latitude=0 and
longitude=0 is not a datapoint that can exist in your dataset. Which is
reasonable for a dataset of New York, but bad for a global dataset.
Only rows where `df.lon_var`, `df.lat_var` are reasonably near New York,
@r-shekhar
r-shekhar / commands.sh
Created April 14, 2017 18:02
Conda setup for Dask
#!/bin/bash
sudo apt update && sudo apt upgrade -y
sudo apt install s3cmd awscli -y
wget https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-x86_64.sh
bash Miniconda*sh -b -p ${HOME}/miniconda3
echo "export PATH=${HOME}/miniconda3/bin:${PATH}" >> ~/.bashrc
export PATH=${HOME}/miniconda3/bin:${PATH}
conda install -c conda-forge geopandas python-snappy dask distributed \
fastparquet fiona numba boto3 jupyter seaborn -y
@r-shekhar
r-shekhar / .zshrc
Last active March 20, 2017 21:32
Zshrc
##############################################################################
#super duper shell wildcards. Makes zsh worth using
setopt extendedglob
##############################################################################
#keep history file between sessions
HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE=$HOME/.history
setopt APPEND_HISTORY