{ "cells": [ { "cell_type": "markdown", "id": "4100353f-21f2-4ef2-acc6-7c432af14afa", "metadata": {}, "source": [ "# Club Elo" ] }, { "cell_type": "code", "execution_count": 1, "id": "605fd454-caf3-4680-89d1-ae836f3e1bf2", "metadata": { "tags": [] }, "outputs": [], "source": [ "import sys\n", "\n", "sys.path.append(\"../../\")\n", "\n", "from penaltyblog.scrapers import ClubElo" ] }, { "cell_type": "markdown", "id": "ba3c458d-0832-408e-b9de-b8135ff881e7", "metadata": {}, "source": [ "### Download all ELO ratings on the 1st January 2020" ] }, { "cell_type": "code", "execution_count": 2, "id": "7e71b59e-1fb5-4a11-90b3-ef8ce5837b4a", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
rankcountrylevelelofromto
team
Liverpool1.0ENG12075.8513182019-12-302020-01-02
Man City2.0ENG12001.5720212019-12-302020-01-01
Barcelona3.0ESP11985.3658452019-12-222020-01-04
Bayern4.0GER11941.5571292019-12-222020-01-19
Juventus5.0ITA11909.9930422019-12-192020-01-06
.....................
Santa ColomaNaNAND0773.9998782019-08-022020-08-08
Matecosa Sant JuliaNaNAND0754.9377442019-08-022020-07-01
Tre FioriNaNSMR0707.4147342019-07-312020-08-08
Tre PenneNaNSMR0676.5460822019-07-312020-08-08
La FioritaNaNSMR0661.1982422019-07-312020-08-08
\n", "

642 rows × 6 columns

\n", "
" ], "text/plain": [ " rank country level elo from to\n", "team \n", "Liverpool 1.0 ENG 1 2075.851318 2019-12-30 2020-01-02\n", "Man City 2.0 ENG 1 2001.572021 2019-12-30 2020-01-01\n", "Barcelona 3.0 ESP 1 1985.365845 2019-12-22 2020-01-04\n", "Bayern 4.0 GER 1 1941.557129 2019-12-22 2020-01-19\n", "Juventus 5.0 ITA 1 1909.993042 2019-12-19 2020-01-06\n", "... ... ... ... ... ... ...\n", "Santa Coloma NaN AND 0 773.999878 2019-08-02 2020-08-08\n", "Matecosa Sant Julia NaN AND 0 754.937744 2019-08-02 2020-07-01\n", "Tre Fiori NaN SMR 0 707.414734 2019-07-31 2020-08-08\n", "Tre Penne NaN SMR 0 676.546082 2019-07-31 2020-08-08\n", "La Fiorita NaN SMR 0 661.198242 2019-07-31 2020-08-08\n", "\n", "[642 rows x 6 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ce = ClubElo()\n", "\n", "ce.get_elo_by_date(\"2020-01-01\")" ] }, { "cell_type": "markdown", "id": "879c5b9b-e4c1-4277-8ddf-c8941b3909c4", "metadata": {}, "source": [ "### List all teams available on clubelo.com" ] }, { "cell_type": "code", "execution_count": 3, "id": "086709cf-29da-4a60-9fc8-d8bac9ad3e88", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
team
0Liverpool
1Man City
2Arsenal
3Inter
4Real Madrid
......
624FCB Magpies
625Atletic Club Escaldes
626SS Virtus
627Tre Penne
628La Fiorita
\n", "

629 rows × 1 columns

\n", "
" ], "text/plain": [ " team\n", "0 Liverpool\n", "1 Man City\n", "2 Arsenal\n", "3 Inter\n", "4 Real Madrid\n", ".. ...\n", "624 FCB Magpies\n", "625 Atletic Club Escaldes\n", "626 SS Virtus\n", "627 Tre Penne\n", "628 La Fiorita\n", "\n", "[629 rows x 1 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ce.get_team_names()" ] }, { "cell_type": "markdown", "id": "55d29da8-d833-4dba-b7c3-5837743ebc6e", "metadata": {}, "source": [ "### Download all historical ratings for Bournemouth" ] }, { "cell_type": "code", "execution_count": 4, "id": "82bab1de-d4b0-45ee-ad69-bfe828aa53c8", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
rankteamcountryleveleloto
from
2024-12-2434.0BournemouthENG11759.3361822024-12-31
2024-12-2334.0BournemouthENG11759.3361822024-12-23
2024-12-1734.0BournemouthENG11759.3361822024-12-22
2024-12-1134.0BournemouthENG11759.3361822024-12-16
2024-12-0935.0BournemouthENG11755.3986822024-12-10
.....................
1987-09-01NaNBournemouthENG21446.3010251987-09-05
1987-08-30NaNBournemouthENG21455.9680181987-08-31
1987-08-23NaNBournemouthENG21451.5488281987-08-29
1987-08-16NaNBournemouthENG21441.6091311987-08-22
1987-07-01NaNBournemouthENG21428.9548341987-08-15
\n", "

1528 rows × 6 columns

\n", "
" ], "text/plain": [ " rank team country level elo to\n", "from \n", "2024-12-24 34.0 Bournemouth ENG 1 1759.336182 2024-12-31\n", "2024-12-23 34.0 Bournemouth ENG 1 1759.336182 2024-12-23\n", "2024-12-17 34.0 Bournemouth ENG 1 1759.336182 2024-12-22\n", "2024-12-11 34.0 Bournemouth ENG 1 1759.336182 2024-12-16\n", "2024-12-09 35.0 Bournemouth ENG 1 1755.398682 2024-12-10\n", "... ... ... ... ... ... ...\n", "1987-09-01 NaN Bournemouth ENG 2 1446.301025 1987-09-05\n", "1987-08-30 NaN Bournemouth ENG 2 1455.968018 1987-08-31\n", "1987-08-23 NaN Bournemouth ENG 2 1451.548828 1987-08-29\n", "1987-08-16 NaN Bournemouth ENG 2 1441.609131 1987-08-22\n", "1987-07-01 NaN Bournemouth ENG 2 1428.954834 1987-08-15\n", "\n", "[1528 rows x 6 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ce.get_elo_by_team(\"Bournemouth\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" } }, "nbformat": 4, "nbformat_minor": 5 }