python-chicago
Information about Chicago and it’s geographies. Inspired by python-us.
Because sometimes you just need to loop through a list of Chicago neighborhoods.
Installation
Install using pip:
pip install chicago
Usage
Iterate over community areas
>>> from chicago import COMMUNITY_AREAS
>>> for ca in COMMUNITY_AREAS:
... print(ca.name, ca.number)
...
('Rogers Park', '1')
('West Ridge', '2')
('Uptown', '3')
('Lincoln Square', '4')
('North Center', '5')
('Lake View', '6')
('Lincoln Park', '7')
('Near North Side', '8')
('Edison Park', '9')
Get a community area by number
>>> COMMUNITY_AREAS.get_by_number(22) CommunityArea(name='Logan Square', number='22')
Iterate over neighborhoods
>>> from chicago import NEIGHBORHOODS >>> for n in NEIGHBORHOODS: ... print(n) Albany Park Andersonville Archer Heights Armour Square Ashburn Auburn Gresham Austin Avalon Park Avondale Belmont Cragin
Iterate over census tracts
>>> from chicago import TRACTS >>> for tract in TRACTS: ... print(tract) 17031010100 17031010100 17031010100 17031010100 17031010201
Get the census tract that contains a Chicago precinct
>>> from chicago import PRECINCTS >>> precinct = PRECINCTS[0] >>> from chicago import get_tract_from_precinct_id >>> tract = get_tract_from_precinct_id(precinct.full_name) >>> print(tract)
Get the census tract that contains a suburban Cook county precinct
>>> from chicago.cook_suburbs import COOK_SUBURBAN_PRECINCTS, get_suburban_cook_tract_from_precinct_number >>> precinct = COOK_SUBURBAN_PRECINCTS[0] >>> tract = get_suburban_cook_tract_from_precinct_number(precinct.objectid) >>> print(tract) 17031804202
Data Sources
Community Areas
Neighborhoods
Boundaries - Neighborhoods from the City of Chicago Data Portal
Building the data
This package uses Invoke to generate the data files that underly the Python API.
Cleaning up build files
invoke clean
Building the data files
This includes the precinct to census tract crosswalk CSVs.
invoke build
Metadata
Release files for chicago 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chicago-0.4.1.tar.gz | 1.7 MB | Without provenance | Details for chicago-0.4.1.tar.gz |
Release files / chicago-0.4.1.tar.gz
| Download URL | chicago-0.4.1.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfa4bd3b8b72e8d9df374aab53cc5d414281e4e1e3bd9ee8a3a8889319922351
|
|
BLAKE2b-256 checksum How to use checksums |
5efff20975cb997bad299e20dcbc3666624222362242a8f8b9e12a745a8e9c50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for chicago 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.