Information about Chicago and it's geographies. Inspired by python-us.
Because sometimes you just need to loop through a list of Chicago neighborhoods.
Install using pip:
pip install chicago
>>> 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')
>>> COMMUNITY_AREAS.get_by_number(22)
CommunityArea(name='Logan Square', number='22')
>>> 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
>>> from chicago import TRACTS
>>> for tract in TRACTS:
... print(tract)
17031010100
17031010100
17031010100
17031010100
17031010201
>>> from chicago import ZIP_CODES
>>> for zip_code in ZIP_CODES:
... print(zip_code)
60601
60602
60603
60604
60605
60606
>>> 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)
>>> 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
>>> from chicago import ZIP_CODES
>>> ZIP_CODES.is_chicago('60651')
True
>>> ZIP_CODES.is_chicago('12345')
False
Boundaries - Community Areas (current))
Boundaries - Neighborhoods from the City of Chicago Data Portal
This package uses Invoke to generate the data files that underly the Python API.
invoke clean
This includes the precinct to census tract crosswalk CSVs.
invoke build