Source: Global Terrorism Database (GTD)
Data and data wrangling process via this gist: https://gist.github.com/chris-creditdesign/e07ff4ab3d879396f2a1
Build with d3.js
| var sheetID = "xxx-id-goes-here-xxx"; | |
| var rowConfig = "timestamp name location favorite note lifespan season contact lat lng zone approve feature".split(" "); | |
| /*** | |
| Requests may come in with the following parameters: | |
| name | |
| favorite - player name (number?) | |
| note |
Source: Global Terrorism Database (GTD)
Data and data wrangling process via this gist: https://gist.github.com/chris-creditdesign/e07ff4ab3d879396f2a1
Build with d3.js
| #!/usr/bin/env python | |
| import sys, tty, termios | |
| fd = sys.stdin.fileno() | |
| old_settings = termios.tcgetattr(fd) | |
| try: | |
| filename = sys.argv[1] | |
| f = open(filename, 'r') | |
| text = f.read() |
This repo's location has changed.
| <html> | |
| <head> | |
| <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
| <title>Lee Enterprises - GOP Caucus/Primary Results</title> | |
| <style> | |
| body { height: 650px; width:610px; | |
| font-family: Arial, sans-serif; } | |
This has been updated here to reflect the coming changes to the Fusion Tables API.
In my quest to learn how to use python within the django framework, the most difficult thing was the development environment, and getting to the point where I could play learn, practice and experiment. Here are some steps that I took to get to that point.
I’ll add to this as I can, but mostly I’m using it as a handy resource that I can access while continuing to learn.
Cribbed from my notes and this blog post.
| #!/usr/bin/env python | |
| import csv, json | |
| from collections import defaultdict | |
| r = csv.reader(open("data.csv")) | |
| headers = r.next() | |
| countries = headers[1:] | |
| out_rows = [] | |
| for row in r: | |
| area = row[0] | |
| out_row = [area] |
| # We will be using the Python library Beautiful Soup | |
| # To scrape the information | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| import re | |
| # Note: This arrest log is available at: | |
| # http://chrisessig.com/arrestlog.PDF | |
| # It was taken from the Waterloo Police Department's website: | |
| # http://www.waterloopolice.com/images/arrestlog.PDF |
| var geojson = L.geoJson(data, { | |
| // style for all vector layers (color, opacity, etc.) (optional) | |
| getStyle: function (feature) { | |
| return feature.properties && feature.properties.style; | |
| }, | |
| // function for creating layers for GeoJSON point features (optional) | |
| pointToLayer: function (feature, latlng) { | |
| return L.marker(latlng, { |