Hi all,

A really quick one today. You may have read last’s months guest tutorial from Yash on how to create a deep completions chart in Python using StatsBomb data like the example seen below in python.

You can check out the full tutorial here, if you missed it previously. I would recommend familiarising yourself with that tutorial as this acts as complimentary to that, and uses the same base code.

Today we will take these learnings from the notebook and recreate the chart within Tableau. I’ve attached the data we will be using alongside an images in the repo found at the top of the page. I will also briefly cover off how I made a few quick transformations to the data to export the material we needed.

Quick recap!

What is meant by deep completions?

Deep completions is defined as the completed passes or carries that end inside the semi-circle with the centre at the mid point of the goal and a diameter equal to the width of the penalty box while originating outside this region.

Python

So the data we use is already in the repo, but if you want the full e2e, i’ve added my code snippet to be appended to Yash’s previous work. You can find the script in the Github Repo.

You will want to follow Yash’s work up until ln14: #Plotting the pitch, where the pitch is created.

In short my further transformations were:

  1. We apply the restrictions of what is considered a deep progression to our dataset.
  2. We then only pick relevant columns of data that we want to take through to Tableau.
  3. We rename a few columns to make them easier to understand.
  4. We glue the carry and pass co-ordinates into a singular column.

With our data exported, found in the repo (deep_progression.csv) is what it looks like.

here’s a snippet of the important columns:

Now into Tableau!

Load our dataset into Tableau.

We will need to union our data on itself.

Why? Because we want to create start and end points for our lines.

Next we need three calculations.

 

We are saying for Calculation 1 & 2:

If the first table then use the start X (where the action started) else use our End X (where the pass or carry finished within the area)

Calculation 3 is a bit of a cheat method to mark the end of the line for aesthetics!

  • The really important part to note here is, in our calculation we refer to the start point coming from the first dataset, and the end point from the second dataset “deep_progression.csv” which was created in our union.
  • Drag 001. X onto rows and 002. Y onto columns and make them dimensions.
  • Drag ID onto detail
  • Drag Type.Name onto colour

Next we will want to add some circles at the end of the carries.

Drag 003. X onto rows and make it a dimension.

Dual axis and synchronise the axis.

Remove measure names from colour.

Next we will want to add the background image which you can find in the repo.

Go to Map -> Background maps and add the picture of the pitch.

One small tip is to fix your axis.

You can use the co-ordinates similar to mine found in my workbook stored at the top of the blog If you get stuck please use this workbook as a reference point.

& There we have it, a simple method of taking our dataset and creating our deep progression chart in Python. It follows similar methods if you want to create passmaps too.

GOING FURTHER

Try finding your own data using the statsbomb api or MPLSoccer python package

Try creating small multiples of the top 10 players that have created the most deep completions

Try using map layers to create the visualisation.

As always let me know how you got on with this one @_CJMayes

LOGGING OFF,

CJ