import cenpy
import osmnx
import contextily
import matplotlib.pyplot as plt
%matplotlib inline
/opt/anaconda3/envs/analysis/lib/python3.8/site-packages/fuzzywuzzy/fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
osmnx
, contextily
, and cenpy.products
work using a place-oriented API. This means that users specify a place name, like Columbus, OH
or Kansas City, MO-KS
, or California
, and the package parses this name and grabs the relevant data. osmnx
uses the Open Street Map service, cenpy
uses the Us Census Bureau’s service, and contextily
has its own distinctive set of providers so they can
sometimes disagree slightly, especially when considering older census products.
Regardless, to grab the US census data using cenpy
, you pass the place name and the columns of the Census product you wish to extract. Below, we’ll grab two columns from the American Community Survey: Total population (B02001_001E
) and count of African American persons (B02001_003E
). We’ll grab this from Austin, TX: