{ "cells": [ { "cell_type": "markdown", "id": "1ee69dc3-2f18-4110-a232-81d807884da9", "metadata": {}, "source": [ "# Understat" ] }, { "cell_type": "code", "execution_count": 1, "id": "2077b457-872d-420d-8799-9457e1a8f50f", "metadata": {}, "outputs": [], "source": [ "import sys\n", "\n", "sys.path.append(\"../../\")\n", "\n", "import penaltyblog as pb" ] }, { "cell_type": "markdown", "id": "56a9acc8-bf3a-4b1d-becb-f9b1e9ca1a09", "metadata": {}, "source": [ "## List available competitions" ] }, { "cell_type": "code", "execution_count": 2, "id": "bea88bf4-476f-4445-9345-379795d85025", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['DEU Bundesliga 1',\n", " 'ENG Premier League',\n", " 'ESP La Liga',\n", " 'FRA Ligue 1',\n", " 'ITA Serie A',\n", " 'RUS Premier League']" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pb.scrapers.Understat.list_competitions()" ] }, { "cell_type": "markdown", "id": "c22b88a5-d0bc-4553-a1b6-700c630a36a7", "metadata": {}, "source": [ "## Get Fixtures" ] }, { "cell_type": "code", "execution_count": 3, "id": "88b75ca5-90dd-4a6e-a0b4-4b1a5a63fec2", "metadata": {}, "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", " \n", " \n", "
understat_iddatetimeteam_hometeam_awaygoals_homegoals_awayxg_homexg_awayforecast_wforecast_dforecast_lseasoncompetitiondate
id
1628812800---brentford---arsenal163762021-08-13 19:00:00BrentfordArsenal201.8881801.0238500.62890.22870.14242021-2022ENG Premier League2021-08-13
1628899200---burnley---brighton163782021-08-14 14:00:00BurnleyBrighton121.7954801.6853000.38940.28770.32292021-2022ENG Premier League2021-08-14
1628899200---chelsea---crystal_palace163792021-08-14 14:00:00ChelseaCrystal Palace301.1870900.3217010.64050.28220.07732021-2022ENG Premier League2021-08-14
1628899200---everton---southampton163802021-08-14 14:00:00EvertonSouthampton312.3886300.5806010.83590.12340.04072021-2022ENG Premier League2021-08-14
1628899200---leicester---wolverhampton_wanderers163812021-08-14 14:00:00LeicesterWolverhampton Wanderers100.6680821.3271400.16830.27500.55672021-2022ENG Premier League2021-08-14
\n", "
" ], "text/plain": [ " understat_id \\\n", "id \n", "1628812800---brentford---arsenal 16376 \n", "1628899200---burnley---brighton 16378 \n", "1628899200---chelsea---crystal_palace 16379 \n", "1628899200---everton---southampton 16380 \n", "1628899200---leicester---wolverhampton_wanderers 16381 \n", "\n", " datetime \\\n", "id \n", "1628812800---brentford---arsenal 2021-08-13 19:00:00 \n", "1628899200---burnley---brighton 2021-08-14 14:00:00 \n", "1628899200---chelsea---crystal_palace 2021-08-14 14:00:00 \n", "1628899200---everton---southampton 2021-08-14 14:00:00 \n", "1628899200---leicester---wolverhampton_wanderers 2021-08-14 14:00:00 \n", "\n", " team_home \\\n", "id \n", "1628812800---brentford---arsenal Brentford \n", "1628899200---burnley---brighton Burnley \n", "1628899200---chelsea---crystal_palace Chelsea \n", "1628899200---everton---southampton Everton \n", "1628899200---leicester---wolverhampton_wanderers Leicester \n", "\n", " team_away \\\n", "id \n", "1628812800---brentford---arsenal Arsenal \n", "1628899200---burnley---brighton Brighton \n", "1628899200---chelsea---crystal_palace Crystal Palace \n", "1628899200---everton---southampton Southampton \n", "1628899200---leicester---wolverhampton_wanderers Wolverhampton Wanderers \n", "\n", " goals_home goals_away \\\n", "id \n", "1628812800---brentford---arsenal 2 0 \n", "1628899200---burnley---brighton 1 2 \n", "1628899200---chelsea---crystal_palace 3 0 \n", "1628899200---everton---southampton 3 1 \n", "1628899200---leicester---wolverhampton_wanderers 1 0 \n", "\n", " xg_home xg_away \\\n", "id \n", "1628812800---brentford---arsenal 1.888180 1.023850 \n", "1628899200---burnley---brighton 1.795480 1.685300 \n", "1628899200---chelsea---crystal_palace 1.187090 0.321701 \n", "1628899200---everton---southampton 2.388630 0.580601 \n", "1628899200---leicester---wolverhampton_wanderers 0.668082 1.327140 \n", "\n", " forecast_w forecast_d \\\n", "id \n", "1628812800---brentford---arsenal 0.6289 0.2287 \n", "1628899200---burnley---brighton 0.3894 0.2877 \n", "1628899200---chelsea---crystal_palace 0.6405 0.2822 \n", "1628899200---everton---southampton 0.8359 0.1234 \n", "1628899200---leicester---wolverhampton_wanderers 0.1683 0.2750 \n", "\n", " forecast_l season \\\n", "id \n", "1628812800---brentford---arsenal 0.1424 2021-2022 \n", "1628899200---burnley---brighton 0.3229 2021-2022 \n", "1628899200---chelsea---crystal_palace 0.0773 2021-2022 \n", "1628899200---everton---southampton 0.0407 2021-2022 \n", "1628899200---leicester---wolverhampton_wanderers 0.5567 2021-2022 \n", "\n", " competition \\\n", "id \n", "1628812800---brentford---arsenal ENG Premier League \n", "1628899200---burnley---brighton ENG Premier League \n", "1628899200---chelsea---crystal_palace ENG Premier League \n", "1628899200---everton---southampton ENG Premier League \n", "1628899200---leicester---wolverhampton_wanderers ENG Premier League \n", "\n", " date \n", "id \n", "1628812800---brentford---arsenal 2021-08-13 \n", "1628899200---burnley---brighton 2021-08-14 \n", "1628899200---chelsea---crystal_palace 2021-08-14 \n", "1628899200---everton---southampton 2021-08-14 \n", "1628899200---leicester---wolverhampton_wanderers 2021-08-14 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "under = pb.scrapers.Understat(\"ENG Premier League\", \"2021-2022\")\n", "df = under.get_fixtures()\n", "df.head()" ] }, { "cell_type": "markdown", "id": "99cf8346-4d24-46f2-9217-7425e96dee69", "metadata": {}, "source": [ "## Get shots from a specific match (using the `understat_id` from the fixtures)" ] }, { "cell_type": "code", "execution_count": 4, "id": "2338420d-9f0b-492a-b827-6074fa21fde5", "metadata": {}, "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", " \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", "
competitionseasondatetimeminuteresultxyx_gplayerh_a...situationshot_typematch_idteam_hometeam_awaygoals_homegoals_awaydateplayer_assistedlast_action
id
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:002SavedShot0.80599998474121090.370999984741210930.03489129990339279Allanh...OpenPlayRightFoot16380EvertonSouthampton312021-08-14NoneNone
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:009MissedShots0.95800003051757810.457999992370605460.11126399785280228Dominic Calvert-Lewinh...OpenPlayHead16380EvertonSouthampton312021-08-14Demarai GrayAerial
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:0033BlockedShot0.7840000152587890.409000015258789040.08816669881343842Lucas Digneh...DirectFreekickLeftFoot16380EvertonSouthampton312021-08-14NoneStandard
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:0034MissedShots0.94099998474121090.52700000762939460.09325270354747772Dominic Calvert-Lewinh...OpenPlayHead16380EvertonSouthampton312021-08-14Andros TownsendCross
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:0043MissedShots0.7740000152587890.6450.01725040003657341Lucas Digneh...FromCornerLeftFoot16380EvertonSouthampton312021-08-14NoneNone
\n", "

5 rows × 21 columns

\n", "
" ], "text/plain": [ " competition season \\\n", "id \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "\n", " datetime minute result \\\n", "id \n", "1628899200---everton---southampton 2021-08-14 14:00:00 2 SavedShot \n", "1628899200---everton---southampton 2021-08-14 14:00:00 9 MissedShots \n", "1628899200---everton---southampton 2021-08-14 14:00:00 33 BlockedShot \n", "1628899200---everton---southampton 2021-08-14 14:00:00 34 MissedShots \n", "1628899200---everton---southampton 2021-08-14 14:00:00 43 MissedShots \n", "\n", " x y \\\n", "id \n", "1628899200---everton---southampton 0.8059999847412109 0.37099998474121093 \n", "1628899200---everton---southampton 0.9580000305175781 0.45799999237060546 \n", "1628899200---everton---southampton 0.784000015258789 0.40900001525878904 \n", "1628899200---everton---southampton 0.9409999847412109 0.5270000076293946 \n", "1628899200---everton---southampton 0.774000015258789 0.645 \n", "\n", " x_g \\\n", "id \n", "1628899200---everton---southampton 0.03489129990339279 \n", "1628899200---everton---southampton 0.11126399785280228 \n", "1628899200---everton---southampton 0.08816669881343842 \n", "1628899200---everton---southampton 0.09325270354747772 \n", "1628899200---everton---southampton 0.01725040003657341 \n", "\n", " player h_a ... \\\n", "id ... \n", "1628899200---everton---southampton Allan h ... \n", "1628899200---everton---southampton Dominic Calvert-Lewin h ... \n", "1628899200---everton---southampton Lucas Digne h ... \n", "1628899200---everton---southampton Dominic Calvert-Lewin h ... \n", "1628899200---everton---southampton Lucas Digne h ... \n", "\n", " situation shot_type match_id \\\n", "id \n", "1628899200---everton---southampton OpenPlay RightFoot 16380 \n", "1628899200---everton---southampton OpenPlay Head 16380 \n", "1628899200---everton---southampton DirectFreekick LeftFoot 16380 \n", "1628899200---everton---southampton OpenPlay Head 16380 \n", "1628899200---everton---southampton FromCorner LeftFoot 16380 \n", "\n", " team_home team_away goals_home \\\n", "id \n", "1628899200---everton---southampton Everton Southampton 3 \n", "1628899200---everton---southampton Everton Southampton 3 \n", "1628899200---everton---southampton Everton Southampton 3 \n", "1628899200---everton---southampton Everton Southampton 3 \n", "1628899200---everton---southampton Everton Southampton 3 \n", "\n", " goals_away date player_assisted \\\n", "id \n", "1628899200---everton---southampton 1 2021-08-14 None \n", "1628899200---everton---southampton 1 2021-08-14 Demarai Gray \n", "1628899200---everton---southampton 1 2021-08-14 None \n", "1628899200---everton---southampton 1 2021-08-14 Andros Townsend \n", "1628899200---everton---southampton 1 2021-08-14 None \n", "\n", " last_action \n", "id \n", "1628899200---everton---southampton None \n", "1628899200---everton---southampton Aerial \n", "1628899200---everton---southampton Standard \n", "1628899200---everton---southampton Cross \n", "1628899200---everton---southampton None \n", "\n", "[5 rows x 21 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shots = under.get_shots(\"16380\")\n", "shots.head()" ] }, { "cell_type": "markdown", "id": "f798684e-baef-4a1a-9434-795623056a16", "metadata": {}, "source": [ "## Get the other stats for the fixture" ] }, { "cell_type": "code", "execution_count": 5, "id": "f20ba7af-78f6-4a6a-a18b-eace50eac2ec", "metadata": {}, "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", "
competitionseasondatetimefidhadateleague_idgoals_homegoals_away...h_lleagueshots_homeshots_awayshots_on_target_homeshots_on_target_awaydeep_homedeep_awayppda_awayppda_home
id
1628899200---everton---southamptonENG Premier League2021-20222021-08-14 14:00:00154954272742021-08-14131...0.0407EPL14663465.59266.8696
\n", "

1 rows × 26 columns

\n", "
" ], "text/plain": [ " competition season \\\n", "id \n", "1628899200---everton---southampton ENG Premier League 2021-2022 \n", "\n", " datetime fid h a \\\n", "id \n", "1628899200---everton---southampton 2021-08-14 14:00:00 1549542 72 74 \n", "\n", " date league_id goals_home \\\n", "id \n", "1628899200---everton---southampton 2021-08-14 1 3 \n", "\n", " goals_away ... h_l league shots_home \\\n", "id ... \n", "1628899200---everton---southampton 1 ... 0.0407 EPL 14 \n", "\n", " shots_away shots_on_target_home \\\n", "id \n", "1628899200---everton---southampton 6 6 \n", "\n", " shots_on_target_away deep_home deep_away \\\n", "id \n", "1628899200---everton---southampton 3 4 6 \n", "\n", " ppda_away ppda_home \n", "id \n", "1628899200---everton---southampton 5.5926 6.8696 \n", "\n", "[1 rows x 26 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "info = under.get_fixture_info(\"16380\")\n", "\n", "info" ] }, { "cell_type": "markdown", "id": "404041e7-071e-4032-a2e3-bc1f2306d8a3", "metadata": {}, "source": [ "## Get the season for Erling Haaland" ] }, { "cell_type": "code", "execution_count": 6, "id": "cd39ac9b-f7a1-45f2-813a-fcb71186cdbc", "metadata": {}, "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", " \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", "
teampositiongamesgoalsshotstimex_gassistsx_akey_passesyellowrednpgnpx_gx_g_chainx_g_buildup
season
2019Borussia DortmundSub15133310618.88935739547014221.5264755114912987900138.88935739547014211.3661879273131492.984985080547631
2020Borussia DortmundFW282792241623.5984838977456164.0354475677013427202520.56736878305673627.1972871273756035.896189399063587
2021Borussia DortmundFW242280191717.03095360100269375.89400206506252323301612.48437255620956419.772441577166324.264734441414475
2022Manchester CityFW3536123280332.76139953732490585.849109854549169529502927.43320986628532431.9633980840444563.285816218703985
2023Manchester CityFW3127122258131.6539966836571754.751755559816956529102025.56464628130197530.197253502905373.128645434975624
2024Manchester CityFW151370135014.53382617235183711.563708476722240411201213.77265733480453512.9360819458961491.5715587697923183
\n", "
" ], "text/plain": [ " team position games goals shots time \\\n", "season \n", "2019 Borussia Dortmund Sub 15 13 33 1061 \n", "2020 Borussia Dortmund FW 28 27 92 2416 \n", "2021 Borussia Dortmund FW 24 22 80 1917 \n", "2022 Manchester City FW 35 36 123 2803 \n", "2023 Manchester City FW 31 27 122 2581 \n", "2024 Manchester City FW 15 13 70 1350 \n", "\n", " x_g assists x_a key_passes yellow red \\\n", "season \n", "2019 8.889357395470142 2 1.5264755114912987 9 0 0 \n", "2020 23.59848389774561 6 4.03544756770134 27 2 0 \n", "2021 17.030953601002693 7 5.894002065062523 23 3 0 \n", "2022 32.761399537324905 8 5.8491098545491695 29 5 0 \n", "2023 31.65399668365717 5 4.7517555598169565 29 1 0 \n", "2024 14.533826172351837 1 1.5637084767222404 11 2 0 \n", "\n", " npg npx_g x_g_chain x_g_buildup \n", "season \n", "2019 13 8.889357395470142 11.366187927313149 2.984985080547631 \n", "2020 25 20.567368783056736 27.197287127375603 5.896189399063587 \n", "2021 16 12.484372556209564 19.77244157716632 4.264734441414475 \n", "2022 29 27.433209866285324 31.963398084044456 3.285816218703985 \n", "2023 20 25.564646281301975 30.19725350290537 3.128645434975624 \n", "2024 12 13.772657334804535 12.936081945896149 1.5715587697923183 " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "player = under.get_player_season(8260)\n", "player" ] }, { "cell_type": "markdown", "id": "6b6fe251-871b-49fb-a558-82878452cc55", "metadata": {}, "source": [ "## Get all Erling Haaland's shots" ] }, { "cell_type": "code", "execution_count": 7, "id": "07c61458-180a-4393-ba32-8c3df67235ea", "metadata": {}, "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", " \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", " \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", "
minuteresultxyx_gplayerh_aunderstat_player_idsituationseason...understat_fixture_idteam_hometeam_awaygoals_homegoals_awaydateplayer_assistedlast_actiondatetimeid
understat_shot_id
35487658Goal0.88800003051757810.66599998474121090.07933320105075836Erling Haalanda8260OpenPlay2019...12562AugsburgBorussia Dortmund352020-01-18Jadon SanchoThroughball2020-01-18 14:30:001579305600---augsburg---borussia_dortmund
35488169Goal0.980.489000015258789060.9206209778785706Erling Haalanda8260OpenPlay2019...12562AugsburgBorussia Dortmund352020-01-18Thorgan HazardPass2020-01-18 14:30:001579305600---augsburg---borussia_dortmund
35488378Goal0.88300003051757810.347000007629394540.32283100485801697Erling Haalanda8260OpenPlay2019...12562AugsburgBorussia Dortmund352020-01-18Marco ReusThroughball2020-01-18 14:30:001579305600---augsburg---borussia_dortmund
35552765BlockedShot0.88599998474121090.6390000152587890.11918099969625473Erling Haalandh8260OpenPlay2019...12566Borussia DortmundFC Cologne512020-01-24Jadon SanchoPass2020-01-24 19:30:001579824000---borussia_dortmund---fc_cologne
35553176Goal0.9550.4950.7466409802436829Erling Haalandh8260OpenPlay2019...12566Borussia DortmundFC Cologne512020-01-24NoneRebound2020-01-24 19:30:001579824000---borussia_dortmund---fc_cologne
..................................................................
6052095SavedShot0.86300003051757810.49299999237060550.07168060541152954Erling Haalandh8260OpenPlay2024...26739Manchester CityNottingham Forest302024-12-04Kevin De BruyneCross2024-12-04 19:30:001733270400---manchester_city---nottingham_forest
60523691MissedShots0.82099998474121090.7009999847412110.2730585038661957Erling Haalandh8260OpenPlay2024...26739Manchester CityNottingham Forest302024-12-04NoneNone2024-12-04 19:30:001733270400---manchester_city---nottingham_forest
6058496SavedShot0.890.52299999237060550.43306636810302734Erling Haalanda8260OpenPlay2024...26747Crystal PalaceManchester City222024-12-07Kevin De BruyneThroughball2024-12-07 15:00:001733529600---crystal_palace---manchester_city
60585729Goal0.92900001525878910.460.2861519753932953Erling Haalanda8260OpenPlay2024...26747Crystal PalaceManchester City222024-12-07Matheus NunesAerial2024-12-07 15:00:001733529600---crystal_palace---manchester_city
60586874BlockedShot0.9650.440.06939429044723511Erling Haalanda8260FromCorner2024...26747Crystal PalaceManchester City222024-12-07Matheus NunesAerial2024-12-07 15:00:001733529600---crystal_palace---manchester_city
\n", "

520 rows × 21 columns

\n", "
" ], "text/plain": [ " minute result x \\\n", "understat_shot_id \n", "354876 58 Goal 0.8880000305175781 \n", "354881 69 Goal 0.98 \n", "354883 78 Goal 0.8830000305175781 \n", "355527 65 BlockedShot 0.8859999847412109 \n", "355531 76 Goal 0.955 \n", "... ... ... ... \n", "605209 5 SavedShot 0.8630000305175781 \n", "605236 91 MissedShots 0.8209999847412109 \n", "605849 6 SavedShot 0.89 \n", "605857 29 Goal 0.9290000152587891 \n", "605868 74 BlockedShot 0.965 \n", "\n", " y x_g player \\\n", "understat_shot_id \n", "354876 0.6659999847412109 0.07933320105075836 Erling Haaland \n", "354881 0.48900001525878906 0.9206209778785706 Erling Haaland \n", "354883 0.34700000762939454 0.32283100485801697 Erling Haaland \n", "355527 0.639000015258789 0.11918099969625473 Erling Haaland \n", "355531 0.495 0.7466409802436829 Erling Haaland \n", "... ... ... ... \n", "605209 0.4929999923706055 0.07168060541152954 Erling Haaland \n", "605236 0.700999984741211 0.2730585038661957 Erling Haaland \n", "605849 0.5229999923706055 0.43306636810302734 Erling Haaland \n", "605857 0.46 0.2861519753932953 Erling Haaland \n", "605868 0.44 0.06939429044723511 Erling Haaland \n", "\n", " h_a understat_player_id situation season ... \\\n", "understat_shot_id ... \n", "354876 a 8260 OpenPlay 2019 ... \n", "354881 a 8260 OpenPlay 2019 ... \n", "354883 a 8260 OpenPlay 2019 ... \n", "355527 h 8260 OpenPlay 2019 ... \n", "355531 h 8260 OpenPlay 2019 ... \n", "... .. ... ... ... ... \n", "605209 h 8260 OpenPlay 2024 ... \n", "605236 h 8260 OpenPlay 2024 ... \n", "605849 a 8260 OpenPlay 2024 ... \n", "605857 a 8260 OpenPlay 2024 ... \n", "605868 a 8260 FromCorner 2024 ... \n", "\n", " understat_fixture_id team_home team_away \\\n", "understat_shot_id \n", "354876 12562 Augsburg Borussia Dortmund \n", "354881 12562 Augsburg Borussia Dortmund \n", "354883 12562 Augsburg Borussia Dortmund \n", "355527 12566 Borussia Dortmund FC Cologne \n", "355531 12566 Borussia Dortmund FC Cologne \n", "... ... ... ... \n", "605209 26739 Manchester City Nottingham Forest \n", "605236 26739 Manchester City Nottingham Forest \n", "605849 26747 Crystal Palace Manchester City \n", "605857 26747 Crystal Palace Manchester City \n", "605868 26747 Crystal Palace Manchester City \n", "\n", " goals_home goals_away date player_assisted \\\n", "understat_shot_id \n", "354876 3 5 2020-01-18 Jadon Sancho \n", "354881 3 5 2020-01-18 Thorgan Hazard \n", "354883 3 5 2020-01-18 Marco Reus \n", "355527 5 1 2020-01-24 Jadon Sancho \n", "355531 5 1 2020-01-24 None \n", "... ... ... ... ... \n", "605209 3 0 2024-12-04 Kevin De Bruyne \n", "605236 3 0 2024-12-04 None \n", "605849 2 2 2024-12-07 Kevin De Bruyne \n", "605857 2 2 2024-12-07 Matheus Nunes \n", "605868 2 2 2024-12-07 Matheus Nunes \n", "\n", " last_action datetime \\\n", "understat_shot_id \n", "354876 Throughball 2020-01-18 14:30:00 \n", "354881 Pass 2020-01-18 14:30:00 \n", "354883 Throughball 2020-01-18 14:30:00 \n", "355527 Pass 2020-01-24 19:30:00 \n", "355531 Rebound 2020-01-24 19:30:00 \n", "... ... ... \n", "605209 Cross 2024-12-04 19:30:00 \n", "605236 None 2024-12-04 19:30:00 \n", "605849 Throughball 2024-12-07 15:00:00 \n", "605857 Aerial 2024-12-07 15:00:00 \n", "605868 Aerial 2024-12-07 15:00:00 \n", "\n", " id \n", "understat_shot_id \n", "354876 1579305600---augsburg---borussia_dortmund \n", "354881 1579305600---augsburg---borussia_dortmund \n", "354883 1579305600---augsburg---borussia_dortmund \n", "355527 1579824000---borussia_dortmund---fc_cologne \n", "355531 1579824000---borussia_dortmund---fc_cologne \n", "... ... \n", "605209 1733270400---manchester_city---nottingham_forest \n", "605236 1733270400---manchester_city---nottingham_forest \n", "605849 1733529600---crystal_palace---manchester_city \n", "605857 1733529600---crystal_palace---manchester_city \n", "605868 1733529600---crystal_palace---manchester_city \n", "\n", "[520 rows x 21 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shots = under.get_player_shots(8260)\n", "shots" ] } ], "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 }