Skip to content

Instantly share code, notes, and snippets.

View hancush's full-sized avatar
🍓

hannah cushman garland hancush

🍓
View GitHub Profile
<iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vSeTcW7T-iNX26MU1FzqfPXKXe3Vqzg8dvztrOVqC7dDKtomdzF3MrvUspgXEiEsEAY3ii0KdDPVvzy/pubhtml?gid=0&amp;single=true&amp;widget=true&amp;headers=false"></iframe>
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 3 columns, instead of 4. in line 1.
Candidate,Votes Total,Votes Percent
"Anthony ""Tony"" Ciaravino",0,0.0,
Ambria Taylor,0,0.0,
"Elvira ""Vida"" Jimenez",0,0.0,
Nicole Lee,0,0.0,
"Froylan ""Froy"" Jimenez",0,0.0,
Steve Demitro,0,0.0,
Don Don,0,0.0,
0 of 23 precincts reporting,,
---
title: "Geocoding template"
output: html_notebook
---
# Instructions
- Upload your file to the data/ directory of this workspace by clicking Upload in the menu bar of the file browser in the lower right pane. Make note of the name of the column containing the addresses you want to geocode.
- Follow these instructions to get an API key for the Google Geocoding API in the Google Console: https://developers.google.com/maps/documentation/geocoding/cloud-setup
- N.b., You have to set up a billing account to use the Google Geocoding API. See details on pricing here: https://developers.google.com/maps/documentation/geocoding/usage-and-billing#pricing-for-product

My R Version:

call-me-hank:analysis-drug-charges hannah$ Rscript --version
R scripting front-end version 4.0.0 (2020-04-24)

After the first round of errors, I uninstalled everything using uninstall.R, then ran install.R. (Both are attached to this gist, for reference.) Here are some excerpts from the output.

Seems like a few packages are not available

$(patsubst %, pensions_%.reordered.csv, $(shell seq 2012 1 2017)) : data/raw/pensions_2012-2017.csv
# some other operations on the downloaded/inflated pensions data
data/raw/pensions_%.csv : data/raw/pensions_%.tar
cd $(dir $@) && tar xvfz $(notdir $<)
data/raw/pensions_%.tar :
wget --no-use-server-timestamps \
https://bga-pensions-database.s3.amazonaws.com/raw/$(notdir $@) -O $@
response = requests.post(some_post_data)
response_data = json.loads(response.data.decode('utf-8'))
print(response_data)
# {
# "status": "ok",
# "matches": [
# {
from lxml import etree
html = '''
<h3>Offense: A Tale of Two Halves</h3>
<p>For a while there, it seemed the Bears' offense might never show up in London. The unit generated just two first downs and 44 total yards in the first half. Then <strong>Chase Daniel</strong> s
tarted hitting his spots, aided with some stellar work by <strong>Allen Robinson</strong> and <strong>Anthony Miller</strong>, to get the rally going. Unfortunately, it was too little, too late wi
th the defense not playing at its best.</p>
<h5>By the numbers:</h5>
<ul>
<li><strong>194 PASSING YARDS:</strong> Daniel had some good moments in completing 22 of 30 passes for 231 yards, but <a href="https://chicago.suntimes.com/bears/2019/10/6/20901945/daniel-takes-th
Employer ID
City of Chicago 16
Chicago 16
Metropolitan Pier and Exposition Authority 53
Metropolitan Pier Exposition Authority 53
Third Lake 364
Village Of Third Lake 364
Fox Valley Park District 519
Fox Valley Park District 519
Homewood Flossmoor Park District 541
# usage: python interval.py /path/to/your/file.csv
import csv
import sys
import re
def days_from_interval(interval):
if interval == 'never':
return None

🤖 Make some data

Your mission

Write a Makefile that gets data from Data.gov and creates a CSV of the 50 most recent datasets uploaded. For each dataset, the output should include:

  • The name of the dataset
  • The date it was uploaded
  • A download link