Skip to content

Instantly share code, notes, and snippets.

View jdickinson202's full-sized avatar

jdickinson202

View GitHub Profile
@jdickinson202
jdickinson202 / ShortIntroToScraping.rst
Created January 30, 2018 07:25 — forked from bradmontgomery/ShortIntroToScraping.rst
Really short intro to scraping with Beautiful Soup and Requests
@jdickinson202
jdickinson202 / shapefile.py
Created December 18, 2017 14:56 — forked from urschrei/shapefile.py
Open a shapefile using Fiona, and plot its features using Matplotlib and Descartes
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
from descartes import PolygonPatch
import fiona
from shapely.geometry import Polygon, MultiPolygon, shape
# We can extract the London Borough boundaries by filtering on the AREA_CODE key
mp = MultiPolygon(
[shape(pol['geometry']) for pol in fiona.open('data/boroughs/boroughs.shp')
if pol['properties']['AREA_CODE'] == 'LBO'])
@jdickinson202
jdickinson202 / panel.py
Created November 19, 2017 02:21
basic panel data models for statsmodels
import scipy
import numpy as np
import pandas as pd
import statsmodels.api as sm
from statsmodels.tools.tools import chain_dot
from statsmodels.tools.decorators import cache_readonly
from statsmodels.regression.linear_model import (RegressionModel,
RegressionResults)
class Group():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can write directly into latex using \"markdown\" by highlighting a cell and then selecting \"markdown\" from the dropdown menu: $$4+x_2^4 = 23$$"
]
},
{
@jdickinson202
jdickinson202 / spatialquery.py
Created May 11, 2017 13:10 — forked from gridcell/spatialquery.py
Spatial Queries in Python
import fiona
import os
import rtree
from collections import defaultdict
from shapely.geometry import shape
CONTAINS = 'contains'
CROSSES = 'crosses'
DISJOINT = 'disjoint'
@jdickinson202
jdickinson202 / geonames.py
Created May 5, 2017 09:43 — forked from pamelafox/geonames.py
Geonames Python wrapper
import sys
import urllib
import urllib2
import json
import logging
class GeonamesError(Exception):
def __init__(self, status):
@jdickinson202
jdickinson202 / geonames-org-wrapper.py
Created May 5, 2017 09:42 — forked from Markbnj/geonames-org-wrapper.py
A simple geonames.org wrapper in python
import requests
import json
# For information on endpoints and arguments see the geonames
# API documentation at:
#
# http://www.geonames.org/export/web-services.html
class Geonames(object):
@jdickinson202
jdickinson202 / computeDistances.py
Created May 4, 2017 08:30 — forked from srosenthal/computeDistances.py
A Python script that prints the distance between an origin and multiple destinations
#!/usr/bin/env python
from optparse import OptionParser
import csv
import json
import StringIO
import sys
import urllib
# Print the distance between an origin and multiple destinations.