How to Create Maps Using GeoPandas and Folium

GeoPandas and Folium are two popular python libraries for creating plots of geospatial data. The great advantage of GeoPandas is the simplicity of use as all you need is a ShapeFile of the area you're interested in and you can start creating plots. Another great advantage is that GeoPandas is very similar to Pandas so it is very easy to use for those familiar with the library. Everything is stored in Series of DataFrames and manipulating them is the exact same as it is in Pandas. One disadvantage of GeoPandas though is that your plots are on a fixed scale and is static with no interactability. That's where Folium comes in. Folium is great in that it creates Leaflet style maps where you can zoom in or out on a map depending on how detailed you want things to be. Using Folium does require converting things to GeoJSON format though, which is slightly more difficult than working with Pandas Series in DataFrames. However the interactability through different tools is Folium is amazing. For this project we used the GeoJSON Tooltip in Folium to display the names of counties when you hover over them, as well as the TimestampedGeoJson plugin to display the change in COVID-19 Cases in each county over time.

Generally all government websites have shape files for their respective boundaries. We got the shapefile for individual counties in California from here:

You can see sample notebooks for creating maps in GeoPandas and Folium below:

Using GeoPandas to create a Density Map
Using Folium to Display Time Series COVID-19 Data