Visualizing Formula 1 Qualifying Battles Using Python, Seaborn and Pandas

Jasper
Towards Formula 1 Analysis
7 min readDec 26, 2021

--

If you’re a Formula 1 fan, you’ve probably heard of “teammate qualifying battles” at some point. It’s a simple comparison between the performance of two teammates during qualifying.

Even though an analysis like this can be very easily obtained by simply Googling the results of a season’s 20-ish qualifying sessions and visualizing it using Excel, doing this in Python is actually a really interesting and insightful exercise. So, if you’re looking to develop your Python-skills and want to learn how to create the graph displayed above, keep on reading!

If you’re completely new to Python, no worries. Make sure to check this tutorial out first:

Step 1: Setting everything up

We start by importing all the libraries we need. If you haven’t installed seaborn yet, make sure to run pip install seaborn in your command line interface. Seaborn is a library that is built on top of Matplotlib, and will help us with creating nice plots.

--

--

Jasper
Towards Formula 1 Analysis

Writing tutorials about Data Analysis & Visualization through Formula 1 Examples