Scraping FBRef to perform comparative football player analysis

This article breaks down some Python functions I wrote in order to compare Arsenal prospects and their attributes, using FBRef

Frank Hopkins
5 min readJul 20, 2021

Introduction

The life of a sports analyst can be one of solitude and struggle. Most importantly there is the issue around data and how a few companies seem to have the monopoly on player data. So, where do I get data in order to make inferences? Well, if you have some fundamental Python skills and a baseline understanding of how to scrape a website, there are a few sites that you can use in your Jupyter environment in order to perform comparative player analysis. In this post I will breakdown some Python functions I wrote in order to scrape the FBRef website to perform comparative player analysis, with some pretty neat and intuitive visualisations.

Preparation

Now before we delve into the the different functions and what they do, you will first want to import all the necessary packages require for scraping and analysis:

import requests
import pandas as pd
from bs4 import BeautifulSoup
import klib as kb
import seaborn as sb
import matplotlib.pyplot as plt
import wes
import matplotlib as mpl
import warnings
import…

--

--

Frank Hopkins

Experimentation Data Scientist, specialising in digital experimentation. Posts ranging from data science to website optimisation and digi-analytics.