Choropleth Maps from DataFrames 🗺️


MicroProject Overview

Geographical data visualizations are some of the most impactful forms of data visualization as it easily allows the user to locate places familiar to themselves. One popular geographical visualization is a Choropleth Map -- a map that shades a geographical region to visually encode data about the region. For example, population density maps and per-capita income maps are common choropleth maps.

In this MicroProject, you will learn about the folium Python library -- https://python-visualization.github.io/folium/ -- to create choropleth maps from a DataFrame! As part of learning this library, you'll explore data from the Division of Management Information (DMI) at The University of Illinois that provides the number of students attending the University of Illinois by their permanent home address.

Additional Python Libraries Needed

In order to complete this MicroProject, you will need an additional library (folium) that is used to create choropleth maps (in addition to the standard data science libraries). To install it, run the following command in your terminal:

  • Windows: py -m pip install folium
  • macOS: python3 -m pip install folium
  • If the above does not work or gives an error, try: pip3 install folium

Data Science Skills

In this microproject, you will strengthen the following Data Science skills:

  • Using the folium library to create a choropleth map
  • Modifying folium quickstart code to use a new dataset
  • Preforming basic data analysis on a DataFrame
  • Gaining an intuitive understanding of the base10 logarithm, and applying is using np.log10

Let's nerd out!

MicroProject in Visual Studio Code
MicroProject in Visual Studio Code
University of Illinois Demographics by State, from the Division of Management Information
University of Illinois Demographics by State, from the Division of Management Information
Choropleth Map of the Home Addresses of Students Attending the University of Illinois
Choropleth Map of the Home Addresses of Students Attending the University of Illinois
Folium 0.14.0 documentation's Quickstart Guide on Choropleth Maps
Folium 0.14.0 documentation's Quickstart Guide on Choropleth Maps

First Time Doing a MicroProject?

Each MicroProject starts with a notebook that we provide to you to get started! You will need to configure a git repository to connect to our `microprojects` remote where we release the starter notebook.


Fetch the Initial Files

In your terminal, navigate to your GitHub repository and merge the initial files by running the following commands:

git fetch microprojects
git merge microprojects/microproject-choropleth-map-dataframe --allow-unrelated-histories -m "Merging initial files"

Complete the Notebook

If the commands above were successful, you have merged in the initial files to start on the MicroProject.

  • Find the new microproject-choropleth-map-dataframe folder.
  • Open microproject-choropleth-map-dataframe.ipynb and complete the MicroProject!

Commit and Grade Your Notebook

Once you have finished your notebook, you must use the built-in GitHub Action to preform automated grading of your MicroProject notebook! You will need to commit your work and then manually run the GitHub Action.

Commit Your Work

To commit your notebook, run the standard git commands in your terminal:

git add -u
git commit -m "microproject completed"
git push

Grade Your Notebook

To grade your notebook, you will need to visit your GitHub repository in your browser.

  • Visit your GitHub repository in your browser
  • Click on the "Actions" tab
  • Under "Workflows", find the workflow for this microproject
  • Click the "Run Workflow" in the blue box, and then the green "Run Workflow"
  • After about 10 seconds, you should see a new job that has started running
    • You can click on the job to watch it run in real-time
    • It will take ~1 minute to run and grade
  • Once the running is complete, the autograding summary will be available!