football-data.co.uk#

[1]:
import sys

sys.path.append("../../")

import penaltyblog as pb

List the available countries to download data for#

[2]:
pb.scrapers.FootballData.list_competitions()
[2]:
['BEL First Division A',
 'DEU Bundesliga 1',
 'DEU Bundesliga 2',
 'ENG Premier League',
 'ENG Championship',
 'ENG League 1',
 'ENG League 2',
 'ENG Conference',
 'ESP La Liga',
 'ESP La Liga Segunda',
 'FRA Ligue 1',
 'FRA Ligue 2',
 'GRC Super League',
 'ITA Serie A',
 'ITA Serie B',
 'NLD Eredivisie',
 'PRT Liga 1',
 'SCO Premier League',
 'SCO Division 1',
 'SCO Division 2',
 'SCO Division 3',
 'TUR Super Lig']

Download the data for the English Premier League#

[3]:
fb = pb.scrapers.FootballData("ENG Premier League", "2021-2022")
df = fb.get_fixtures()

df.head()
[3]:
date datetime season competition div time team_home team_away fthg ftag ... b365_cahh b365_caha pcahh pcaha max_cahh max_caha avg_cahh avg_caha goals_home goals_away
id
1628812800---brentford---arsenal 2021-08-13 2021-08-13 20:00:00 2021-2022 ENG Premier League E0 20:00 Brentford Arsenal 2 0 ... 1.75 2.05 1.81 2.13 2.05 2.17 1.80 2.09 2 0
1628899200---burnley---brighton 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Burnley Brighton 1 2 ... 1.79 2.15 1.81 2.14 1.82 2.19 1.79 2.12 1 2
1628899200---chelsea---crystal_palace 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Chelsea Crystal Palace 3 0 ... 2.05 1.75 2.12 1.81 2.16 1.93 2.06 1.82 3 0
1628899200---everton---southampton 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Everton Southampton 3 1 ... 2.05 1.88 2.05 1.88 2.08 1.90 2.03 1.86 3 1
1628899200---leicester---wolves 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Leicester Wolves 1 0 ... 2.02 1.91 2.01 1.92 2.05 1.95 1.99 1.89 1 0

5 rows × 111 columns

Download the data for the English Premier League and map team names#

[4]:
team_mappings = pb.scrapers.get_example_team_name_mappings()

fb = pb.scrapers.FootballData("ENG Premier League", "2021-2022", team_mappings)
df = fb.get_fixtures()

df.head()
[4]:
date datetime season competition div time team_home team_away fthg ftag ... b365_cahh b365_caha pcahh pcaha max_cahh max_caha avg_cahh avg_caha goals_home goals_away
id
1628812800---brentford---arsenal 2021-08-13 2021-08-13 20:00:00 2021-2022 ENG Premier League E0 20:00 Brentford Arsenal 2 0 ... 1.75 2.05 1.81 2.13 2.05 2.17 1.80 2.09 2 0
1628899200---burnley---brighton 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Burnley Brighton 1 2 ... 1.79 2.15 1.81 2.14 1.82 2.19 1.79 2.12 1 2
1628899200---chelsea---crystal_palace 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Chelsea Crystal Palace 3 0 ... 2.05 1.75 2.12 1.81 2.16 1.93 2.06 1.82 3 0
1628899200---everton---southampton 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Everton Southampton 3 1 ... 2.05 1.88 2.05 1.88 2.08 1.90 2.03 1.86 3 1
1628899200---leicester_city---wolverhampton_wanderers 2021-08-14 2021-08-14 15:00:00 2021-2022 ENG Premier League E0 15:00 Leicester City Wolverhampton Wanderers 1 0 ... 2.02 1.91 2.01 1.92 2.05 1.95 1.99 1.89 1 0

5 rows × 111 columns

[ ]: