Skip to content

Instantly share code, notes, and snippets.

View linwoodc3's full-sized avatar

Linwood Creekmore linwoodc3

  • United States
View GitHub Profile
@linwoodc3
linwoodc3 / style.css
Created April 22, 2018 03:01
A simple css file for the QB web app.
body {
background-color: #E5E5FF;
}
img.resize {
max-width:70%;
max-height:70%;
}
#the-string {
display: none;
}
@linwoodc3
linwoodc3 / index.html
Created April 22, 2018 03:00
Simple front end for machine learning web application demo
<!DOCTYPE html>
<html>
<title>QB-Spective</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body { font-family: sans-serif; }
@linwoodc3
linwoodc3 / timenormalize.py
Last active October 18, 2017 11:29
Get a timezone string from a latitude and longitude pair for timezone normalization.
# Created by: Linwood Creekmore III
# valinvescap@gmail.com
from tzwhere import tzwhere
tz = tzwhere.tzwhere()
import numpy as np
def getT(x):
try:
latitude=x[1]
@linwoodc3
linwoodc3 / worldDataframes.py
Last active October 1, 2017 15:11
Python code to create geodataframe for countries, lakes, and oceans for geospatial analysis in Python. Use geopandas and Python 2 or download the
#Author: Linwood Creekmore
#Date: October 1, 2017
# Instructions:
"""
Download and use my shapefilereader function in Python 2 OR just download the linked zip to your computer and read using geopandas
gist to shapefilereader - > https://gist.github.com/linwoodc3/72b2f24b6d2ff6ffde1597f1ca2dea3f
"""
@linwoodc3
linwoodc3 / shapefilereader.py
Last active September 23, 2017 00:12
Using Python 2 (doesn't work for 3), this function reads zipped shapefiles from the web or disk and convert it into a Python geodataframe (pandas dataframe with spatial features).
import geopandas as gpd
import numpy as np
import requests
import gdal
import fiona
import uuid
import re
# informaed by: https://gis.stackexchange.com/questions/225586/reading-raw-data-into-geopandas/225627
@linwoodc3
linwoodc3 / tweetCountryChoropleth.py
Last active April 22, 2017 23:18
Simple code to create a choropleth based on the number of tweets.
def continentlabs(row):
shape = row['geometry'].centroid
x,y = shape.x,shape.y
return (x,y,row['name'])
%matplotlib inline
from matplotlib import legend
f, ax = plt.subplots(1, figsize=(20, 12))
gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')).plot(ax=ax,color='white',linewidth=0.2)
gdf.merge(countdf,left_on='name',right_on='NAME').plot(column='counted',cmap='OrRd',scheme='Fisher_Jenks',ax=ax,linewidth=0.1,edgecolor='white',legend=True,alpha=0.4)
@linwoodc3
linwoodc3 / ddlTwitterPlotters.py
Created April 18, 2017 03:13
matplotlib plotting functions for my District Data Labs Twitter post.
# Author: Linwood Creekmore
# email: valinvescap@gmail.com
# date: 17 April 2017
import matplotlib.pyplot as plt
from matplotlib import gridspec
import matplotlib.patches as patches
import datetime
import pandas as pd
@linwoodc3
linwoodc3 / linwood_utilities.py
Last active April 11, 2017 11:12
Utility functions for District Data Labs blog on geolocated social media. These functions clean and prepare Twitter data for geospation analysis, in addition to removing personally identifying information.
# Author:
# Linwood Creekmore III
# email: valinvescap@gmail.com
# Custom functions for Twitter Geospatial Analysis Blog
#################################
# Class for corrupt json
#################################
@linwoodc3
linwoodc3 / nba_data_utils.py
Last active February 25, 2017 21:10
Utility functions to clean ESPN.com's NBA data.
# By: Linwood Creekmore
# https://www.linkedin.com/in/linwood-creekmore-iii-a2174538/
from dateutil.parser import parse
from concurrent.futures import ProcessPoolExecutor
from functools import partial
import datetime
import re
import numpy as np
import pandas as pd
@linwoodc3
linwoodc3 / jupytercontribnbextensioninstall.log
Created January 15, 2017 02:16
jupyter contrib nbextension install --user log
[I 21:11:04 InstallContribNbextensionsApp] jupyter contrib nbextension install --user
[I 21:11:04 InstallContribNbextensionsApp] Installing jupyter_contrib_nbextensions nbextension files to jupyter data directory
[I 21:11:04 InstallContribNbextensionsApp] Installing /Users/linwood/anaconda3/lib/python3.5/site-packages/jupyter_contrib_nbextensions/nbextensions/code_prettify -> code_prettify
[I 21:11:04 InstallContribNbextensionsApp] Up to date: /Users/linwood/Library/Jupyter/nbextensions/code_prettify/code_prettify.js
[I 21:11:04 InstallContribNbextensionsApp] Up to date: /Users/linwood/Library/Jupyter/nbextensions/code_prettify/code_prettify.yaml
[I 21:11:04 InstallContribNbextensionsApp] Up to date: /Users/linwood/Library/Jupyter/nbextensions/code_prettify/demo-jv.gif
[I 21:11:04 InstallContribNbextensionsApp] Up to date: /Users/linwood/Library/Jupyter/nbextensions/code_prettify/demo-py.gif
[I 21:11:04 InstallContribNbextensionsApp] Up to date: /Users/linwood/Library/Jupyter/nbextensions/code_prettify/demo-R