Plotting Geometries¶

The world around us is split up into lots of different kinds of geometries. The big ones are continents; from there we go down to countries, states, districts, counties, and so on.

On the city level, where we are in this case, there are usually a bunch of federal options (PUMAs or electoral districts for example) as well as a variety of usually more targetted geographical aggregations provided by the city government. Usually no matter where you go, however, the lowest-level geometries in the United States are census tracts. Census tracts are created every ten years for the census, and are built to try to contain either 4000 or 0 people (in the case of parks, beaches, etc.).

Boston GIS released data on the census tracts in their city not long after the 2010 census went out, and that's what we'll use.

However, the data comes in the form of a complex and convoluted GIS-standard data format known as a shapefile (further reading).

pandas has no facilities for reading shapefiles.

When Wes McKinney was first introducing pandas to a wider audience, he was asked more than once why he was doing it when everyone was getting along so well passing raw numpy arrays back and forth all the time (remember, hindsight is 20/20). Reading shapefiles into Python used to be a similarly terrible experience, until geopandas came along and changed everything for the better.

Now you don't need to know anything at all about shapefiles to work with them, you just do this: