Source: Global Terrorism Database (GTD)
Data and data wrangling process via this gist: https://gist.github.com/chris-creditdesign/e07ff4ab3d879396f2a1
Build with d3.js
Source: Global Terrorism Database (GTD)
Data and data wrangling process via this gist: https://gist.github.com/chris-creditdesign/e07ff4ab3d879396f2a1
Build with d3.js
d3.json( | |
"data/statistics.geojson", | |
function (json) { | |
//dimensions | |
var w = 980; | |
var h = 480; | |
//get the center of the data | |
var center = d3.geo.centroid(json); | |
var svg = d3.select("body").append("svg") | |
.attr("width", w) |
by Dan Nguyen @dancow
tl;dr: a quick example of practicing reproducible data journalism, and somewhat timely given the recent school vaccination law signed by California Gov. Jerry Brown
These are scripts that are part of the mundaneprogramming.github.io repo for SRCCON 2015 and will soon have their own entry/explanation on that site. They aren't meant to be best/canonical practices (e.g. I felt like using csv.DictWriter so there it is), nor do I guarantee that they work. But you're free to run them to see what happens. All they currently do is download the relevant spreadsheets and compile them into a file, which ends up being one of the most tedious parts of the entire investigation due to how the [files are organized on the home
from csv import DictReader, DictWriter | |
from os import environ | |
from time import sleep | |
import requests | |
FNAME = 'mx-syria.csv' | |
ONAME = FNAME + 'geocoded.csv' | |
API_KEY = environ['MAPZEN_SEARCH_KEY'] | |
BASE_URL = 'https://search.mapzen.com/v1/search' | |
This is a short SQL tutorial on how to do multiple transformation/aggregates of a table in order to perform analyses of the kind:
Given a list of grocery stores that includes how much fruit they've sold, per type of fruit, e.g.:
| store | fruit | price | sold |
Two simple examples of quickly loading data into PostgreSQL with the COPY command.
Much more sophisticated stuff is possible. Refer to the official docs and consider adopting a wrapper like django-postgres-copy for more complicated tasks.
In 2002, the Help America Vote Act required (among other things) that states must maintain a "computerized statewide voter registration list". These lists (henceforth "voterfiles") contain information about every registered voter and their voting history.
When people who have not worked with voterfile data before hear about voterfiles, their first response is almost always "But in my 8th grade civics class, I learned that a critical component of American democracy is the secret ballot! How can states have a list of how you vote?" Voterfiles do NOT include information about how an individual voted. They report whether an individual voted in a specific election.
The exact format and contents of a publicly available voterfile differ from state to state. At a minimum, a file will contain: