Data Visualization with Python (9): Generating Maps with Folium

Sawsan Yusuf
8 min readMay 23, 2023

This article will teach us how to create maps for different objectives. To do that, we will part ways with Matplotlib and work with another Python visualization library, namely Folium.

What is nice about Folium is that it was developed for the sole purpose of visualizing geospatial data. While other libraries are available to visualize geospatial data, such as plotly, they might have a cap on how many API calls you can make within a defined time frame. Folium, on the other hand, is entirely free.

1. Exploring Datasets with pandas and Matplotlib

1.1 Libraries:

This article heavily relies on pandas and Numpy for data wrangling, analysis, and visualization. The primary plotting library we will explore in this article is Folium.

1.2. Dataset:

We will use the San Francisco Police Department Incidents 2003–2018 — Police Department Incidents from San Francisco public data portal. Incidents derived from San Francisco Police Department (SFPD) Crime Incident Reporting system and updated daily. The address and location have been anonymized by moving to a mid-block or an intersection.

2. Downloading and Prepping Data

--

--