Member-only story

Identifying Football’s xG Outliers with FBref Data using Python + Selenium

The Scraper Guy
5 min readJan 10, 2025

--

Identify players over and under performing xG stats this season

Introduction

Today we will scrape the FBRef player stats for the top 5 Football European leagues to determine which players with a minimum of 5 goals are overperforming and underperforming relative to their xG (Expected goals).

If you are unfamiliar with the xG metric see the below article, which explains how it is calculated.

We will use Selenium and Chromedriver in this project so make sure both are installed and downloaded correctly!

With that being said lets get into the code.

Code Walkthrough

Lets begin by importing some libraries we will need in this project.

import json
import pandas as pd
from datetime import date
import statsmodels
import numpy as np
import datetime
from datetime import datetime
import time
import pandas as pd
import numpy as np
import math #The Python math module
from scipy import stats #The…

--

--

The Scraper Guy
The Scraper Guy

Written by The Scraper Guy

Teaching You How to Scrape Using Python LinkTree - https://linktr.ee/scrapingguy

No responses yet