Chapter 7. GeoPandas and Spatial Statistics
Maps are beautiful. The stories they tell can be so captivating that it’s easy to unintentionally disregard the geospatial statistics within them. But geospatial maps are not simply static images. There is information embedded in them, such as attributes associated with a specific feature in a GIS layer or pixel densities observed in raster images.
Python has a variety of packages for working with geospatial data. If you are familiar with Python, you likely know pandas, a data analysis tool built specifically for Python. Pandas allows us to read a wide variety of data types into a dataframe: a set of tables containing rows (which denote records) and columns (denoting attributes). GeoPandas is an extension of pandas that lets you manipulate geometric and geospatial data using what it calls a GeoDataFrame: a geospatial dataframe in which each row is a spatial feature, such as a point, line, or polygon.
This chapter will show you how to analyze your data and create maps using GeoPandas and GeoDataFrames, as well as some other important packages, such as matplotlib to visualize data and Census Data API. You will also learn how to access geospatial files and delve deeper into demographic data by creating and comparing demographic maps.
Installing GeoPandas
To install GeoPandas, you’ll use conda and conda-forge in your terminal. As in previous chapters, I’ll also show you how to create an environment for all the files you’ll need to work ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access