Skip to content

Instantly share code, notes, and snippets.

View mroswell's full-sized avatar

Marjorie Roswell mroswell

View GitHub Profile
import xlrd
import sys
import uuid
from lxml import etree as ET
def _gen_group_indices(book, sheet_index):
"""
Create data structure to store lists of row indices keyed by _parent_index.
Sample dict:
@mroswell
mroswell / new_examples.rst
Created October 18, 2017 18:05
Altair new documentation draft

New Examples

============ ============== ================================= Data Type Shorthand Code Description ------------ -------------- ---------------------------------quantitative Q a continuous real-valued quantity ordinal O a discrete ordered quantity

@mroswell
mroswell / quirky-monthly-chart.json
Created October 16, 2017 22:24
aiming for monthly labels at angles in altair. (This is an export from Altair)
{
"data": {
"values": [
{
"count": 126,
"CollectDate": "2016-02-24"
},
{
"count": 121,
"CollectDate": "2016-03-30"
@mroswell
mroswell / altair-chart-in-progress.txt
Last active October 17, 2017 20:45
display month labels
date_chart1 = Chart(date_countsDF,
description='A linechart showing dates on x, and a count of turkey chemical residue tests on y'
).mark_line().encode(
X('CollectDate:T', timeUnit='yearmonth'),
Y('count:Q', aggregate='sum')
)
date_chart1.configure_cell(height=270, width=800)
# date_chart1.configure_axis(ticks=20)
-----------
@mroswell
mroswell / docker-commands-output.txt
Created October 10, 2017 23:01
recording console statements from kobo-docker install
marjorieroswell (master) kobo-docker $ docker-compose pull
Pulling postgres (kobotoolbox/postgres:latest)...
latest: Pulling from kobotoolbox/postgres
22ecafbbcc4a: Pull complete
580435e0a086: Pull complete
8321ffd10031: Pull complete
08b8f28a13c2: Pull complete
2b401702069a: Pull complete
a3ed95caeb02: Pull complete
eae027dcdc0e: Pull complete
{
"status": "OK",
"copyright": "Copyright (c) 2017 Pro Publica Inc. All Rights Reserved.",
"results": [{
"congress": "115",
"chamber": "House",
"id": "HSAS",
"name": "Committee on Armed Services",
"url": "https://armedservices.house.gov/",
"num_results": 63,
{
"status": "OK",
"copyright": "Copyright (c) 2017 Pro Publica Inc. All Rights Reserved.",
"results": [{
"congress": "115",
"chamber": "Senate",
"num_results": 20,
"committees": [{
"id": "SSAF",
"name": "Committee on Agriculture, Nutrition, and Forestry",
{"results":[{"committee_id":"HSAG03","members":[{"side":"majority","rank":1,"title":"Chair","legislator":{"bioguide_id":"T000467","birthday":"1959-07-27","chamber":"house","contact_form":null,"crp_id":"N00029736","district":5,"facebook_id":"CongressmanGT","fax":"202-225-5796","fec_ids":["H8PA05071"],"first_name":"Glenn","gender":"M","govtrack_id":"412317","icpsr_id":20946,"in_office":true,"last_name":"Thompson","leadership_role":null,"middle_name":null,"name_suffix":null,"nickname":null,"oc_email":"Rep.Thompson@opencongress.org","ocd_id":"ocd-division/country:us/state:pa/cd:5","office":"124 Cannon House Office Building","party":"R","phone":"202-225-5121","state":"PA","state_name":"Pennsylvania","term_end":"2019-01-03","term_start":"2017-01-03","thomas_id":"01952","title":"Rep","twitter_id":"CongressmanGT","votesmart_id":24046,"website":"https://thompson.house.gov","youtube_id":"CongressmanGT"}},{"side":"majority","rank":2,"title":null,"legislator":{"bioguide_id":"K000362","birthday":"1949-05-28","chamber":"ho
{"results":[{"chamber":"house","committee_id":"HSAG29","name":"Livestock and Foreign Agriculture","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true},{"chamber":"house","committee_id":"HSAG14","name":"Biotechnology, Horticulture, and Research","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true},{"chamber":"house","committee_id":"HSAG16","name":"General Farm Commodities and Risk Management","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true},{"chamber":"house","committee_id":"HSAG15","name":"Conservation and Forestry","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true},{"chamber":"house","committee_id":"HSAG22","name":"Commodity Exchanges, Energy, and Credit","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true},{"chamber":"house","committee_id":"HSAG03","name":"Nutrition","parent_committee_id":"HSAG","phone":"(202) 225-2171","subcommittee":true}],"count":6,"page":{"count":6,"per_page":null,"page":n
{"results":[{"committee_id":"SSAF","members":[{"side":"majority","rank":1,"title":"Chairman","legislator":{"bioguide_id":"R000307","birthday":"1936-04-20","chamber":"senate","contact_form":"https://www.roberts.senate.gov/public/?p=EmailPat","crp_id":"N00005285","district":null,"facebook_id":"SenPatRoberts","fax":"202-224-3514","fec_ids":["S6KS00080","H0KS01016"],"first_name":"Pat","gender":"M","govtrack_id":"300083","icpsr_id":14852,"in_office":true,"last_name":"Roberts","leadership_role":null,"lis_id":"S260","middle_name":null,"name_suffix":null,"nickname":null,"oc_email":"Sen.Roberts@opencongress.org","ocd_id":"ocd-division/country:us/state:ks","office":"109 Hart Senate Office Building","party":"R","phone":"202-224-4774","senate_class":2,"state":"KS","state_name":"Kansas","state_rank":"senior","term_end":"2021-01-03","term_start":"2015-01-06","thomas_id":"00968","title":"Sen","twitter_id":"SenPatRoberts","votesmart_id":26866,"website":"https://www.roberts.senate.gov","youtube_id":"SenPatRoberts"}},{"side":"