{ "cells": [ { "cell_type": "markdown", "id": "fdfeabe5-ff98-444e-a107-de870427f5f5", "metadata": {}, "source": [ "# football-data.co.uk" ] }, { "cell_type": "code", "execution_count": 1, "id": "01177c79-baa8-4f27-a3f3-4c8e2737c563", "metadata": { "tags": [] }, "outputs": [], "source": [ "import sys\n", "\n", "sys.path.append(\"../../\")\n", "\n", "import penaltyblog as pb" ] }, { "cell_type": "markdown", "id": "d2787af4-680c-4fdf-835c-082602443172", "metadata": {}, "source": [ "### List the available countries to download data for" ] }, { "cell_type": "code", "execution_count": 2, "id": "6c0c661b-9ae2-4c41-a354-5f9ab6870f28", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "['BEL First Division A',\n", " 'DEU Bundesliga 1',\n", " 'DEU Bundesliga 2',\n", " 'ENG Premier League',\n", " 'ENG Championship',\n", " 'ENG League 1',\n", " 'ENG League 2',\n", " 'ENG Conference',\n", " 'ESP La Liga',\n", " 'ESP La Liga Segunda',\n", " 'FRA Ligue 1',\n", " 'FRA Ligue 2',\n", " 'GRC Super League',\n", " 'ITA Serie A',\n", " 'ITA Serie B',\n", " 'NLD Eredivisie',\n", " 'PRT Liga 1',\n", " 'SCO Premier League',\n", " 'SCO Division 1',\n", " 'SCO Division 2',\n", " 'SCO Division 3',\n", " 'TUR Super Lig']" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pb.scrapers.FootballData.list_competitions()" ] }, { "cell_type": "markdown", "id": "9be833ab-9653-402c-8dd9-decaeffe39d1", "metadata": {}, "source": [ "### Download the data for the English Premier League" ] }, { "cell_type": "code", "execution_count": 3, "id": "dd11c0a6-3ed1-4131-9dbb-020c89ce066c", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | date | \n", "datetime | \n", "season | \n", "competition | \n", "div | \n", "time | \n", "team_home | \n", "team_away | \n", "fthg | \n", "ftag | \n", "... | \n", "b365_cahh | \n", "b365_caha | \n", "pcahh | \n", "pcaha | \n", "max_cahh | \n", "max_caha | \n", "avg_cahh | \n", "avg_caha | \n", "goals_home | \n", "goals_away | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
1628812800---brentford---arsenal | \n", "2021-08-13 | \n", "2021-08-13 20:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "20:00 | \n", "Brentford | \n", "Arsenal | \n", "2 | \n", "0 | \n", "... | \n", "1.75 | \n", "2.05 | \n", "1.81 | \n", "2.13 | \n", "2.05 | \n", "2.17 | \n", "1.80 | \n", "2.09 | \n", "2 | \n", "0 | \n", "
1628899200---burnley---brighton | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Burnley | \n", "Brighton | \n", "1 | \n", "2 | \n", "... | \n", "1.79 | \n", "2.15 | \n", "1.81 | \n", "2.14 | \n", "1.82 | \n", "2.19 | \n", "1.79 | \n", "2.12 | \n", "1 | \n", "2 | \n", "
1628899200---chelsea---crystal_palace | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Chelsea | \n", "Crystal Palace | \n", "3 | \n", "0 | \n", "... | \n", "2.05 | \n", "1.75 | \n", "2.12 | \n", "1.81 | \n", "2.16 | \n", "1.93 | \n", "2.06 | \n", "1.82 | \n", "3 | \n", "0 | \n", "
1628899200---everton---southampton | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Everton | \n", "Southampton | \n", "3 | \n", "1 | \n", "... | \n", "2.05 | \n", "1.88 | \n", "2.05 | \n", "1.88 | \n", "2.08 | \n", "1.90 | \n", "2.03 | \n", "1.86 | \n", "3 | \n", "1 | \n", "
1628899200---leicester---wolves | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Leicester | \n", "Wolves | \n", "1 | \n", "0 | \n", "... | \n", "2.02 | \n", "1.91 | \n", "2.01 | \n", "1.92 | \n", "2.05 | \n", "1.95 | \n", "1.99 | \n", "1.89 | \n", "1 | \n", "0 | \n", "
5 rows × 111 columns
\n", "\n", " | date | \n", "datetime | \n", "season | \n", "competition | \n", "div | \n", "time | \n", "team_home | \n", "team_away | \n", "fthg | \n", "ftag | \n", "... | \n", "b365_cahh | \n", "b365_caha | \n", "pcahh | \n", "pcaha | \n", "max_cahh | \n", "max_caha | \n", "avg_cahh | \n", "avg_caha | \n", "goals_home | \n", "goals_away | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
1628812800---brentford---arsenal | \n", "2021-08-13 | \n", "2021-08-13 20:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "20:00 | \n", "Brentford | \n", "Arsenal | \n", "2 | \n", "0 | \n", "... | \n", "1.75 | \n", "2.05 | \n", "1.81 | \n", "2.13 | \n", "2.05 | \n", "2.17 | \n", "1.80 | \n", "2.09 | \n", "2 | \n", "0 | \n", "
1628899200---burnley---brighton | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Burnley | \n", "Brighton | \n", "1 | \n", "2 | \n", "... | \n", "1.79 | \n", "2.15 | \n", "1.81 | \n", "2.14 | \n", "1.82 | \n", "2.19 | \n", "1.79 | \n", "2.12 | \n", "1 | \n", "2 | \n", "
1628899200---chelsea---crystal_palace | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Chelsea | \n", "Crystal Palace | \n", "3 | \n", "0 | \n", "... | \n", "2.05 | \n", "1.75 | \n", "2.12 | \n", "1.81 | \n", "2.16 | \n", "1.93 | \n", "2.06 | \n", "1.82 | \n", "3 | \n", "0 | \n", "
1628899200---everton---southampton | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Everton | \n", "Southampton | \n", "3 | \n", "1 | \n", "... | \n", "2.05 | \n", "1.88 | \n", "2.05 | \n", "1.88 | \n", "2.08 | \n", "1.90 | \n", "2.03 | \n", "1.86 | \n", "3 | \n", "1 | \n", "
1628899200---leicester_city---wolverhampton_wanderers | \n", "2021-08-14 | \n", "2021-08-14 15:00:00 | \n", "2021-2022 | \n", "ENG Premier League | \n", "E0 | \n", "15:00 | \n", "Leicester City | \n", "Wolverhampton Wanderers | \n", "1 | \n", "0 | \n", "... | \n", "2.02 | \n", "1.91 | \n", "2.01 | \n", "1.92 | \n", "2.05 | \n", "1.95 | \n", "1.99 | \n", "1.89 | \n", "1 | \n", "0 | \n", "
5 rows × 111 columns
\n", "