CenPy - An exploratory interface to the Census API
So, I was looking to do some programmatic access to US Census Bureau data and was finding myself a little frustrated with how limited current tools in Python were to work with the connections. Mainly, most supported only a few protocols, provided no documentation or exploration functionality, and left it primarily up to exeternal documentation to provide information on how to query the API. Now, I know the day of National Civic Hacking is tomorrow, but I figured I’d get a jumpstart…
So, I designed a small package to interface with any Census API that
follows the same get, for, in key specifications. The tool,
cenpy provides a Connection object,
which pulls down the metadata needed to explore the dataset. Connection objects
have a query method that is easily to use and outputs directly to a pandas
dataframe. The connection object transparently records what queries are executed
and is easy to extend. Plus, if new connections are announced that follow the
specifications provided by the census currently, the package will discover and
provide those connections too!
Right now, I haven’t packged it up for pip yet. But, adding it to your pythonpath should work just fine. Alternatively, check out the demo and see its functionality. Honestly, I’m super excited about the number of datasources that this makes easily accessible!
Originally posted on yetanothergeographer.tumblr.com.