How to Make Maps with Python (Part 1: Plot the World with GeoPandas)
7 min readMay 15, 2024
Plot the world with 7 lines of code.
Online resources for making maps in Python are a hodge-podge of incomplete tutorials and odd StackOverflow answers. They don’t answer in simple terms: “How do you just make a map?”
This series of articles will cover how to create maps in Python, from simple to complex. In this article, we will make the simplest map possible of the world to show you just how easy it is.
All of the code in this tutorial is available in a Kaggle notebook.
Requirements
- Python 3
- (optional) a Kaggle account
Steps
- Install Pandas, GeoPandas, Geodatasets, and Matplotlib
- Create a Python file (or Kaggle notebook)
- Import Pandas, GeoPandas, Geodatasets, and Matplotlib
- Load map data for the world from Geodatasets
- Plot the map data
- Bonus: Plot country boundaries
Step 1: Install Pandas, GeoPandas, Geodatasets, and Matplotlib
The libraries Pandas, GeoPandas, Geodatasets, and Matplotlib are some of the most popular…