{ "cells": [ { "cell_type": "markdown", "id": "7100de70", "metadata": {}, "source": [ "1. Pobieranie bazy" ] }, { "cell_type": "code", "execution_count": 6, "id": "17518731", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning: Your Kaggle API key is readable by other users on this system! To fix this, you can run 'chmod 600 /home/osboxes/.kaggle/kaggle.json'\n", "Downloading extended-football-stats-for-european-leagues-xg.zip to /home/osboxes/jupyter_dir/notebooks/IUM03\n", " 73%|███████████████████████████▋ | 1.00M/1.37M [00:00<00:00, 5.12MB/s]\n", "100%|██████████████████████████████████████| 1.37M/1.37M [00:00<00:00, 3.95MB/s]\n" ] } ], "source": [ "!kaggle datasets download -d slehkyi/extended-football-stats-for-european-leagues-xg" ] }, { "cell_type": "code", "execution_count": 7, "id": "0d9abb90", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Archive: extended-football-stats-for-european-leagues-xg.zip\n", " inflating: understat.com.csv \n", " inflating: understat_per_game.csv \n" ] } ], "source": [ "!unzip -o extended-football-stats-for-european-leagues-xg.zip" ] }, { "cell_type": "markdown", "id": "edcb45ce", "metadata": {}, "source": [ "2. Zmiana nazwy plikow" ] }, { "cell_type": "code", "execution_count": 8, "id": "cb6595a3", "metadata": {}, "outputs": [], "source": [ "mv understat.com.csv understat.csv" ] }, { "cell_type": "markdown", "id": "b4aea8ec", "metadata": {}, "source": [ "3. Zmiana nazwy kolumn" ] }, { "cell_type": "code", "execution_count": 9, "id": "6c519048", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "understat = pd.read_csv('understat.csv')\n", "understat_per_game = pd.read_csv('understat_per_game.csv')" ] }, { "cell_type": "code", "execution_count": 18, "id": "fc730d10", "metadata": {}, "outputs": [], "source": [ "understat.rename( columns={'Unnamed: 0':'league'}, inplace=True)\n", "understat.rename( columns={'Unnamed: 1':'year'}, inplace=True)" ] }, { "cell_type": "code", "execution_count": 19, "id": "5b636526", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | league | \n", "year | \n", "position | \n", "team | \n", "matches | \n", "wins | \n", "draws | \n", "loses | \n", "scored | \n", "missed | \n", "... | \n", "xGA | \n", "xGA_diff | \n", "npxGA | \n", "npxGD | \n", "ppda_coef | \n", "oppda_coef | \n", "deep | \n", "deep_allowed | \n", "xpts | \n", "xpts_diff | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "La_liga | \n", "2014 | \n", "1 | \n", "Barcelona | \n", "38 | \n", "30 | \n", "4 | \n", "4 | \n", "110 | \n", "21 | \n", "... | \n", "28.444293 | \n", "7.444293 | \n", "24.727907 | \n", "73.049305 | \n", "5.683535 | \n", "16.367593 | \n", "489 | \n", "114 | \n", "94.0813 | \n", "0.0813 | \n", "
1 | \n", "La_liga | \n", "2014 | \n", "2 | \n", "Real Madrid | \n", "38 | \n", "30 | \n", "2 | \n", "6 | \n", "118 | \n", "38 | \n", "... | \n", "42.607198 | \n", "4.607198 | \n", "38.890805 | \n", "47.213090 | \n", "10.209085 | \n", "12.929510 | \n", "351 | \n", "153 | \n", "81.7489 | \n", "-10.2511 | \n", "
2 | \n", "La_liga | \n", "2014 | \n", "3 | \n", "Atletico Madrid | \n", "38 | \n", "23 | \n", "9 | \n", "6 | \n", "67 | \n", "29 | \n", "... | \n", "29.069107 | \n", "0.069107 | \n", "26.839271 | \n", "25.748737 | \n", "8.982028 | \n", "9.237091 | \n", "197 | \n", "123 | \n", "73.1353 | \n", "-4.8647 | \n", "
3 | \n", "La_liga | \n", "2014 | \n", "4 | \n", "Valencia | \n", "38 | \n", "22 | \n", "11 | \n", "5 | \n", "70 | \n", "32 | \n", "... | \n", "39.392572 | \n", "7.392572 | \n", "33.446477 | \n", "16.257501 | \n", "8.709827 | \n", "7.870225 | \n", "203 | \n", "172 | \n", "63.7068 | \n", "-13.2932 | \n", "
4 | \n", "La_liga | \n", "2014 | \n", "5 | \n", "Sevilla | \n", "38 | \n", "23 | \n", "7 | \n", "8 | \n", "71 | \n", "45 | \n", "... | \n", "47.862742 | \n", "2.862742 | \n", "41.916529 | \n", "20.178070 | \n", "8.276148 | \n", "9.477805 | \n", "305 | \n", "168 | \n", "67.3867 | \n", "-8.6133 | \n", "
5 rows × 24 columns
\n", "\n", " | league | \n", "year | \n", "h_a | \n", "xG | \n", "xGA | \n", "npxG | \n", "npxGA | \n", "deep | \n", "deep_allowed | \n", "scored | \n", "... | \n", "ppda_coef | \n", "ppda_att | \n", "ppda_def | \n", "oppda_coef | \n", "oppda_att | \n", "oppda_def | \n", "team | \n", "xG_diff | \n", "xGA_diff | \n", "xpts_diff | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "Bundesliga | \n", "2014 | \n", "h | \n", "2.57012 | \n", "1.198420 | \n", "2.57012 | \n", "1.198420 | \n", "5 | \n", "4 | \n", "2 | \n", "... | \n", "9.625000 | \n", "231 | \n", "24 | \n", "21.850000 | \n", "437 | \n", "20 | \n", "Bayern Munich | \n", "0.57012 | \n", "0.198420 | \n", "-0.6514 | \n", "
1 | \n", "Bundesliga | \n", "2014 | \n", "a | \n", "1.50328 | \n", "1.307950 | \n", "1.50328 | \n", "1.307950 | \n", "10 | \n", "1 | \n", "1 | \n", "... | \n", "4.756098 | \n", "195 | \n", "41 | \n", "17.695652 | \n", "407 | \n", "23 | \n", "Bayern Munich | \n", "0.50328 | \n", "0.307950 | \n", "0.5143 | \n", "
2 | \n", "Bundesliga | \n", "2014 | \n", "h | \n", "1.22987 | \n", "0.310166 | \n", "1.22987 | \n", "0.310166 | \n", "13 | \n", "3 | \n", "2 | \n", "... | \n", "5.060606 | \n", "167 | \n", "33 | \n", "16.961538 | \n", "441 | \n", "26 | \n", "Bayern Munich | \n", "-0.77013 | \n", "0.310166 | \n", "-0.8412 | \n", "
3 | \n", "Bundesliga | \n", "2014 | \n", "a | \n", "1.03519 | \n", "0.203118 | \n", "1.03519 | \n", "0.203118 | \n", "6 | \n", "2 | \n", "0 | \n", "... | \n", "4.423077 | \n", "115 | \n", "26 | \n", "9.446809 | \n", "444 | \n", "47 | \n", "Bayern Munich | \n", "1.03519 | \n", "0.203118 | \n", "1.1367 | \n", "
4 | \n", "Bundesliga | \n", "2014 | \n", "h | \n", "3.48286 | \n", "0.402844 | \n", "3.48286 | \n", "0.402844 | \n", "23 | \n", "2 | \n", "4 | \n", "... | \n", "4.250000 | \n", "170 | \n", "40 | \n", "44.800000 | \n", "448 | \n", "10 | \n", "Bayern Munich | \n", "-0.51714 | \n", "0.402844 | \n", "-0.0713 | \n", "
5 rows × 29 columns
\n", "