Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hunterowens
hunterowens / code.py
Created September 30, 2018 23:39
Altair Example
import pandas as pd
import altair as alt
plot_series = df.groupby('Fiscal Year')['cost'].sum()
alt.Chart(plot_series).mark_line().encode(
x='??',
y='??'
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(WC)COLLEGE 4.573086161316465e-05
(WC)COMMERCE 7.811226607265858e-05
(WC)DOWNTOWN 9.382139547962573e-05
(WC)NORTHVILLAGE 3.036583737626928e-05
(WC)PARK 4.8626335599410734e-05
(WC)RIVER 1.457644034573669e-05
(WC)TOPANGA 1.7167484641628468e-05
(WC)UPTOWN 5.187003275184904e-05
A1 0.006122153253938159
A1(UV) 9.70492413789753e-07
@hunterowens
hunterowens / ex.py
Created January 14, 2018 19:50
example_catagory
def catagorize(row):
"""
apply function to catagorize a set of traing data values into
catagories.
"""
sentiment = 0
focus = 0
energy_level = 0 ## TODO replace with real
if sentiment > 0:
if focus > 0: # focus outward
@hunterowens
hunterowens / Example_Stuct.go
Last active December 14, 2017 17:17
earthquake_mesage_example.md
type DMEvent struct {
XMLName xml.Name `xml:"event_message"`
Category string `xml:"category,attr"`
MsgType string `xml:"message_type,attr"`
OrigSys string `xml:"orig_sys,attr"`
Version string `xml:"version,attr"`
Description string `xml:",innerxml"`
Core []DMCore `xml:"core_info"`
ElarmsMsg []ElarmsMsg `xml:"elarms_info"`
OnsiteMsg []OnsiteMsg `xml:"onsite_info"`
library(tidyverse)
dot_data <- read_csv('./path/to/dot.csv')
311_data <- read_csv('./path/to/311.csv')
# Shared headers, based on dot list you gave me
headers <- c(Columns by SR # / CD # / Request Type / Address / Description / Submit Date / Closed Date / Current Status / Owner)
dot_data %>%
@hunterowens
hunterowens / test.py
Created July 19, 2017 21:23
311 Loader and counter
import pandas as pd
df = pd.read_csv('path/to/csv')
df.groupby(['CD','RequestType']).count().to_csv('2016_311_counts.csv')