Skip to content

trezeguet74/UnderStatScrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Note: UnderStat website contains only league matches data, not UEFA Champions league or International matches.

This notebook contains a code scrapes the data for a single player from understat.com website, which provides a statistical data for the top 5 leagues from 2014/2015 season until now. You can scrape all the data you need by only passing the player id from the website, and then this notebook will do it all. To accomplish my work, I have used some sources I'll mention them lately.

To explain my code, I'll use the Egyptian king "Mohamed Salah" as an example:

search tab

After passing the player id, there are many functions to find and filter the data you want:

1- GetMatchesData():

this function returns a csv. file contains all the matches played for this player in the top 5 leagues since 2014/2015 season with match details and the player performance in this match.

Scraped table from the website:

matches data

Output table:

GetMatchesData

2- PlayerSeasonStats():

This function focuses on a particular season entered by the user, and gives output as below:

PlayerSeasonStats

3- PlayerCareerStats():

This function returns as csv. file with the summary statistics for every season like below:

PlayerCareerStats

4- TabularShotsData():

This function scrapes the intetractive shotmap in the website and returns it in a csv. file:

TabularShotsData

5- TimeTier():

This function filter the shots by the time interval, which was set for every 15 minutes.

The output:

TimeTier

6- xGTier():

This function filter the shots by the shot quality, which was set using the table below:

xG Tier

The output:

xG Tier

7- ShotsArea():

This function returns a csv. file with the shot zones filtered by season.

The output:

ShotsArea

8- PlotShots()

This function recreates the interactive shot map using mplsoocer package

shotmap

9- KeyPassers()

This function displays the top key passers for the player, and returns the output in a csv. file

The Output:

keypassers

10- KeyPassTypes()

This function displays the top key pass types, and returns the output in a csv. file.

The Output:

KeyPassTypes

Sources: