A football data analysis tool
Project description
myfootballanalytics is a user-friendly, in-house developed python-based tool to analyse and visualise football data in order to assess the performance of football clubs and players and extract meaningful insights.
- Website: https://github.com/isamathr/myfootballanalytics
- Documentation: https://github.com/isamathr/myfootballanalytics/blob/main/Instructions_manual.pdf
Capabilities
By using myfootballanalytics, you will be able to answer questions such as:
- Does Mourinho play the catenaccio of the modern years?
- Was Guardiola’s Barcelona better than Heynckes’s Bayern Munich?
- Is Robert Lewandowski a ’killer’ striker?
and visualise your findings.
Prerequisites
-
Install Python3 (at least 3.6) directly from its website https://www.python.org/downloads/ or via anaconda https://www.anaconda.com/
-
Make sure package manager 'pip' is up-to-date
python -m pip install --upgrade pip
-
Install the following external python pachakges using 'pip'
pip install beautifulsoup4 pip install requests pip install tqdm pip install mplsoccer
Getting Started
Use the following input file to run the code.
import myfootballanalytics as mfa
update_id_file = True ## Updates file containing match ids from https://understat.com/
get_data = False ## Scrapes data from https://understat.com/ and saves them in the defined directory
analyze_match = False ## Plots the position of all shots of a given match and provides a table with information
analyze_league = False ## Plots xG figure for the teams of the selected league over the selected seasons
analyze_team = False ## Plots xG figure for the selected team over the selected seasons
## Relevant if get_data = True
save_csv_file_leagues = True ## Saves league’s data to csv file
## Relevant if analyze_league = True
save_csv_file_players = True ## Saves players’ data to csv file
## Relevant if update_id_file = True
parallel = True ## Activates multiprocessing for faster results.
## Relavant for all tags
save_dir_path = "" ## Saving directory. Default: current working directory. Empty string activates the default setting.
## Relevant if get_data = True
leagues = ['PremierLeague','Ligue1','Bundesliga','LaLiga','SerieA'] ## Available leagues: Ligue1, PremierLeague, Bundesliga, LaLiga, SerieA
## Relevant if get_data = True or analyze_league = True or analyze_team = True
seasons = ['2014-2015','2015-2016','2016-2017','2017-2018','2018-2019','2019-2020','2020-2021','2021-2022','2022-2023']
## Relevant if analyze_match = True
home_team = "FC Cologne" ## Available teams: all teams
away_team = "Bayern Munich" ## Available teams: all teams
season = "2022-2023" ## Available season: all seasons
## Relevant if analyze_league = True
league = "Bundesliga" ## Choose league to analyze. Available leagues: Ligue1, PremierLeague, Bundesliga, LaLiga, SerieA
## Relavant if analyze_team = True
team = "Arsenal" ## Available teams: all teams
if update_id_file:
ids = mfa.FindIDs(parallel,save_dir_path)
if get_data:
data = mfa.DataUpdater(leagues,seasons,save_dir_path,save_csv_file_leagues)
if analyze_match:
md = mfa.MatchDataLoader(home_team,away_team,season,save_dir_path)
match_data = md.load_match_data()
match = mfa.MatchAnalyzer(match_data)
table = match.analyze_match()
print(table)
if analyze_league:
league_data = mfa.LeagueAnalyzer(league,seasons,save_dir_path,save_csv_file_players)
if analyze_team:
td = mfa.TeamDataLoader(seasons,team,save_dir_path)
team_data = td.load_team_data()
team_analysis = mfa.TeamAnalyzer(team_data,seasons,team)
team_analysis.analyze_team()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for myfootballanalytics-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76b0b6460fddbb45c40bdc4feab34a09d9120cb56167665112d54405e122988c |
|
MD5 | 963bbe65e54d64eae98f33500410fcfa |
|
BLAKE2b-256 | ade1fc4d4cf1e3e6dbefd62be69aa674adeecba0594369f9ce95fb8941f694b0 |
Close
Hashes for myfootballanalytics-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4294a13b080dc96e2abd07af049eb0ef3667eeb176f6d6b4bf64b493552322d3 |
|
MD5 | 3de0170f18b71a29534ae89821c9879d |
|
BLAKE2b-256 | ff39dce17db91a62031ff86368a4aedacb855b584068ebd148a70ae6d1be71ff |