Skip to content

Instantly share code, notes, and snippets.

View mroswell's full-sized avatar

Marjorie Roswell mroswell

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>USA states population</Name>
<UserStyle>
<Name>population</Name>
<Title>Population in the United States</Title>
<Abstract>A sample filter that filters the United States into three
@mroswell
mroswell / wordcount.py
Created August 3, 2017 22:12
word count
fname = 'google_maps_terms.txt'
handle = open(fname)
word_dict = {}
word_count = {}
word_count['count'] = 0
for line in handle:
line = line.rstrip()
words = line.split()
for word in words:
# word_dict[word] = word_dict.get(word, 0 ) + 1
@mroswell
mroswell / module2-challenge.ipynb
Last active June 23, 2017 00:45
Module 2 Challenge | Python for Data Journalists: Analyzing Money in Politics via JournalismCourses.org
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
00_installation.md
01_index.md
02_instance.md
03_syntax.md
04_computed.md
05_class-and-style.md
06_conditional.md
07_list.md
08_events.md
09_forms.md
@mroswell
mroswell / people.py
Created March 19, 2017 14:58
md people.py (draft)
import re
from collections import defaultdict
import lxml.html
from pupa.scrape import Person, Scraper
def _get_table_item(doc, name):
""" fetch items out of table that has a left column of th """
return doc.xpath('//th[contains(text(), "%s")]/following-sibling::td' % name)[0]
// Add Shortcode
function ip_btn_shortcode( $atts , $content = null ) {
// Attributes
$atts = shortcode_atts(
array(
'width' => '',
'height' => '',
),
$atts,
violation_id inspection_id violation_category violation_date violation_date_closed violation_type
204851 261019 Garbage and Refuse 2012-01-03 00:00:00 2012-02-02 00:00:00 Refuse Accumulation
204852 261019 Unsanitary Conditions 2012-01-03 00:00:00 2012-02-02 00:00:00 Unsanitary conditions, not specified
204853 261023 Garbage and Refuse 2012-01-03 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
204854 261023 Garbage and Refuse 2012-01-03 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
204858 261029 Garbage and Refuse 2012-01-03 00:00:00 2012-03-12 00:00:00 Refuse Accumulation
204859 261029 Animals and Pests 2012-01-03 00:00:00 2012-03-12 00:00:00 Animals and Pests, not specified
207746 264687 Animals and Pests 2012-02-08 00:00:00 2012-04-02 00:00:00 Animals and Pests, not specified
205869 262387 Garbage and Refuse 2012-01-13 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
207417 264347 Garbage and Refuse 2012-01-11 00:00:00 2012-01-13 00:00:00 Refuse Accumulation
@mroswell
mroswell / Violations-2012.csv
Last active July 14, 2016 09:26
code-for-america-application
204851 261019 Garbage and Refuse 2012-01-03 00:00:00 2012-02-02 00:00:00 Refuse Accumulation
204852 261019 Unsanitary Conditions 2012-01-03 00:00:00 2012-02-02 00:00:00 Unsanitary conditions, not specified
204853 261023 Garbage and Refuse 2012-01-03 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
204854 261023 Garbage and Refuse 2012-01-03 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
204858 261029 Garbage and Refuse 2012-01-03 00:00:00 2012-03-12 00:00:00 Refuse Accumulation
204859 261029 Animals and Pests 2012-01-03 00:00:00 2012-03-12 00:00:00 Animals and Pests, not specified
207746 264687 Animals and Pests 2012-02-08 00:00:00 2012-04-02 00:00:00 Animals and Pests, not specified
205869 262387 Garbage and Refuse 2012-01-13 00:00:00 2012-01-17 00:00:00 Refuse Accumulation
207417 264347 Garbage and Refuse 2012-01-11 00:00:00 2012-01-13 00:00:00 Refuse Accumulation
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 39 columns, instead of 17. in line 2.
latitude,longitude,indexmatch,rownum,last_name,dist,county,delegate,hb0980,track,nimsp_candidate_id,full_name,id,first_name,middle_name,district,district_padded,sort1,state,votesmart_id,party,email,all_ids/0,all_ids/1,leg_id,active,transparencydata_id,nickname,photo_url,url,country,created_at,level,nimsp_id,phone,offices/0/address,suffixes,all_ids/2,twitter
39.59149004,-79.1173274,1A,46,Beitzel,1A,Garrett & Allegany,"Beitzel, Wendell R.",NAY,c,80704,Wendell R Beitzel,MDL000247,Wendell,R,1A,01A,1,md,66729,Republican,wendell.beitzel@house.state.md.us,MDL000247,MDL000480,MDL000247,TRUE,b89adea064134919ad82b3427a59d5a2,,http://mgaleg.maryland.gov/2015RS/images/beitzel.jpg,http://mgaleg.maryland.gov/webmga/frmMain.aspx?pid=sponpage&tab=subject6&id=beitzel&stab=01,us,8/27/2010 22:54:00,state,8567,410-841-3435,"309 House Office Building
6 Bladen Street
Annapolis, MD 21401
Fax: 301-858-3040",,,bietzelw
39.67322086,-78.837856,1B,47,Buckel,1B,Allegany,"Buckel, Jason C.",NAY,c,,Jason C. Buckel,MDL000637,Jason C.,,1B,
@mroswell
mroswell / README.md
Created November 9, 2015 13:57 — forked from mbostock/.block
Treemap

A treemap recursively subdivides area into rectangles; the area of any node in the tree corresponds to its value. This example uses color to encode different packages of the Flare visualization toolkit. Treemap design invented by Ben Shneiderman. Squarified algorithm by Bruls, Huizing and van Wijk. Data courtesy Jeff Heer.