-
Assemble
web_infoby iterating over table cells parsed from Legistar GUI -
Assemble terms by iterating over City Council terms from Legistar API, adding members to the
web_infodict as we go -
Assemble
membersby iterating overterms, storing names as keys, and Person objects, loaded with memberships for each City Council term, as values -
Continue to assemble
membersby iterating over body offices for each committee, storing memberships on the appropriate Person objects (or minting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from make_a_formset import formset | |
| # populate your formset | |
| for form in formset: | |
| form_data = form.clean_data | |
| # {'name': 'Hannah', 'favorite_color': 'yellow'} | |
| # do stuff with the data |
Where test.txt contains:
a string with some extra spaces
line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # header | |
| here's what this is | |
| <<>>= | |
| import pandas as pd | |
| @ | |
| <<>>= | |
| data = pd.read_csv('path/to/your/data') # returns a dataframe |
Install django-storages:
pip install django-storagesAdd to settings:
INSTALLED_APPS = (
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TABLES=$(mdb-tables /path/to/YOUR_ACCDB.accdb); \ | |
| for TABLE in $TABLES; \ | |
| do mdb-export /path/to/YOUR_ACCDB.accdb $TABLE > /path/to/$TABLE.csv; \ | |
| done; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models import Q | |
| condition = Q() | |
| employers = Employer.objects.all() | |
| if params: | |
| if params.get('name'): | |
| employers = employers.annotate(search_vector=SearchVector('name')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |