This notebook shows the shortest path to fetching a Census group and displaying it as a dimension table.
from morpc_census import Endpoint, CensusAPI, DimensionTable1. Build an Endpoint¶
An Endpoint pairs a survey name with a vintage year.
ep = Endpoint('dec/pl', 2020)2. Fetch the data¶
CensusAPI takes an endpoint, a scope, and a group code. Here we fetch B02001 (Race) for the 15-county MORPC region.
api = CensusAPI(ep, 'region15', group='P1')
api.longLoading...
3. Display as a DimensionTable¶
DimensionTable parses the !!-delimited variable labels into named columns and pivots to a wide layout. B02001 has two label levels: a grand total and a race category.
dim = DimensionTable(api.long)
dim.wide()Loading...