{ "cells": [ { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "#import packages\n", "import pandas as pd\n", "import matplotlib as mpl\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#read in data from csv this is from a premier league game Southampton vs Bournemouth in 2019\n", "#I scrpaed this data from understat. I would recommend checking out the tutorial on scraping understat on my Youtube channel\n", "#https://www.youtube.com/c/McKayJohns\n", "df = pd.read_csv('xgtutorial.csv')" ] }, { "cell_type": "code", "execution_count": 4, "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", "
Unnamed: 0minuteteamxGplayerresult
001Southampton0.105402Nathan RedmondBlockedShot
112Southampton0.136320Jan BednarekBlockedShot
222Southampton0.037217Oriol RomeuBlockedShot
332Southampton0.021404James Ward-ProwseBlockedShot
443Southampton0.066363Pierre-Emile HøjbjergBlockedShot
559Southampton0.363826Nathan RedmondSavedShot
6611Southampton0.354095Shane LongGoal
7717Southampton0.036274Nathan RedmondMissedShots
8821Southampton0.076804Danny IngsMissedShots
9923Southampton0.380378Shane LongSavedShot
101023Southampton0.608956Shane LongShotOnPost
111147Southampton0.027636Ryan BertrandMissedShots
121249Southampton0.026454Nathan RedmondMissedShots
131354Southampton0.033908James Ward-ProwseGoal
141457Southampton0.429492Danny IngsSavedShot
151558Southampton0.021995Danny IngsSavedShot
161660Southampton0.050620Matt TargettBlockedShot
171760Southampton0.053497Nathan RedmondMissedShots
181866Southampton0.086690Matt TargettGoal
191971Southampton0.011735Pierre-Emile HøjbjergMissedShots
202079Southampton0.023274Nathan RedmondMissedShots
212181Southampton0.018172Pierre-Emile HøjbjergMissedShots
222219Bournemouth0.516069Dan GoslingGoal
232331Bournemouth0.016307David BrooksSavedShot
242431Bournemouth0.515468Callum WilsonGoal
252551Bournemouth0.025648Jack SimpsonMissedShots
262672Bournemouth0.034942Ryan FraserMissedShots
272782Bournemouth0.017407Joshua KingMissedShots
282885Bournemouth0.973102Callum WilsonGoal
292987Bournemouth0.506683Callum WilsonSavedShot
303094Bournemouth0.024924Joshua KingMissedShots
\n", "
" ], "text/plain": [ " Unnamed: 0 minute team xG player \\\n", "0 0 1 Southampton 0.105402 Nathan Redmond \n", "1 1 2 Southampton 0.136320 Jan Bednarek \n", "2 2 2 Southampton 0.037217 Oriol Romeu \n", "3 3 2 Southampton 0.021404 James Ward-Prowse \n", "4 4 3 Southampton 0.066363 Pierre-Emile Højbjerg \n", "5 5 9 Southampton 0.363826 Nathan Redmond \n", "6 6 11 Southampton 0.354095 Shane Long \n", "7 7 17 Southampton 0.036274 Nathan Redmond \n", "8 8 21 Southampton 0.076804 Danny Ings \n", "9 9 23 Southampton 0.380378 Shane Long \n", "10 10 23 Southampton 0.608956 Shane Long \n", "11 11 47 Southampton 0.027636 Ryan Bertrand \n", "12 12 49 Southampton 0.026454 Nathan Redmond \n", "13 13 54 Southampton 0.033908 James Ward-Prowse \n", "14 14 57 Southampton 0.429492 Danny Ings \n", "15 15 58 Southampton 0.021995 Danny Ings \n", "16 16 60 Southampton 0.050620 Matt Targett \n", "17 17 60 Southampton 0.053497 Nathan Redmond \n", "18 18 66 Southampton 0.086690 Matt Targett \n", "19 19 71 Southampton 0.011735 Pierre-Emile Højbjerg \n", "20 20 79 Southampton 0.023274 Nathan Redmond \n", "21 21 81 Southampton 0.018172 Pierre-Emile Højbjerg \n", "22 22 19 Bournemouth 0.516069 Dan Gosling \n", "23 23 31 Bournemouth 0.016307 David Brooks \n", "24 24 31 Bournemouth 0.515468 Callum Wilson \n", "25 25 51 Bournemouth 0.025648 Jack Simpson \n", "26 26 72 Bournemouth 0.034942 Ryan Fraser \n", "27 27 82 Bournemouth 0.017407 Joshua King \n", "28 28 85 Bournemouth 0.973102 Callum Wilson \n", "29 29 87 Bournemouth 0.506683 Callum Wilson \n", "30 30 94 Bournemouth 0.024924 Joshua King \n", "\n", " result \n", "0 BlockedShot \n", "1 BlockedShot \n", "2 BlockedShot \n", "3 BlockedShot \n", "4 BlockedShot \n", "5 SavedShot \n", "6 Goal \n", "7 MissedShots \n", "8 MissedShots \n", "9 SavedShot \n", "10 ShotOnPost \n", "11 MissedShots \n", "12 MissedShots \n", "13 Goal \n", "14 SavedShot \n", "15 SavedShot \n", "16 BlockedShot \n", "17 MissedShots \n", "18 Goal \n", "19 MissedShots \n", "20 MissedShots \n", "21 MissedShots \n", "22 Goal \n", "23 SavedShot \n", "24 Goal \n", "25 MissedShots \n", "26 MissedShots \n", "27 MissedShots \n", "28 Goal \n", "29 SavedShot \n", "30 MissedShots " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "#now that we have our dataframe set up, we are going to create some lists to plot the different xG values\n", "#4 lists - home and away xg and minutes\n", "#We start these with zero so our charts will start at 0\n", "a_xG = [0]\n", "h_xG= [0]\n", "a_min = [0]\n", "h_min = [0]\n", "\n", "\n", "#this finds our team names from the dataframe. This will only work as long as both teams took a shot\n", "hteam = df['team'].iloc[0]\n", "ateam = df['team'].iloc[-1]\n", "\n", "for x in range(len(df['xG'])):\n", " if df['team'][x]==ateam:\n", " a_xG.append(df['xG'][x])\n", " a_min.append(df['minute'][x])\n", " if df['team'][x]==hteam:\n", " h_xG.append(df['xG'][x])\n", " h_min.append(df['minute'][x])\n", " \n", "#this is the function we use to make our xG values be cumulative rather than single shot values\n", "#it goes through the list and adds the numbers together\n", "def nums_cumulative_sum(nums_list):\n", " return [sum(nums_list[:i+1]) for i in range(len(nums_list))]\n", "\n", "a_cumulative = nums_cumulative_sum(a_xG)\n", "h_cumulative = nums_cumulative_sum(h_xG)\n", "\n", "#this is used to find the total xG. It just creates a new variable from the last item in the cumulative list\n", "alast = round(a_cumulative[-1],2)\n", "hlast = round(h_cumulative[-1],2)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAFCCAYAAABb+RE3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnKElEQVR4nO3deXhTdd738U+ThtIlbUPSsDnDKMoqiLJYEZUbGG11cJ577hnxcXdEZRwEUQTEDZdbFh0RFFxQUFERUHFFcERFUUEQR0VZiwIq0CakbZq2aZr0+UPtY2mB0iXnJH2/rmuua3LOL8n3d3Kwn+v3PTlJOCMnt0oAAAAwnMXoAgAAAPAzghkAAIBJEMwAAABMgmAGAABgEgQzAAAAkyCYAQAAmATBDAAAwCQIZgAAACZBMAMAADAJghkAAIBJEMwAAABMgmAGAABgEonRfLNWNpsevn+GbDabrFarPlizRguee77WuDGjrlV2//4KBoOa+q8HtS0vL5plAgAAGCKqwawiFNINk25RWXm5rFar5jzwgNZt2KBvt2ytHpPdv5+O6dBRF101Uj26ddWNo0dr1Lhx0SwTAADAEFFvZZaVl0uSEhMTlZhoVVVVzf2DsrO1ctUqSdK3W7YqLS1VTocj2mUCAABEXVRXzCTJYrFo3uxZ6tihg159801t3rq1xn6X06V8T0H14wKPRy6XS16fL9qlAgAARFXUg1kkEtFVo69XWmqq7r39Nh3bqZO+27Wren9CQu3nVB28rCZpeG6OhufkSpLWbdigJcuWKTUlRfa0NElSvsejpKQkZdjtkiSP1ytrolWOjExJqg56v67G+YoKFa4My+V0SpKK/H4Fg0G5XS5Jkr+kRIHSUrVzuyVJgdJSFfv9auvOkiXBorLyMhUV+5XldMpqtao8GFRh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rVy1StPvmiKr1aq7pk1v8tcPVlQoMbHmfy7T09Pr/fyi4mJ99c03emHpS3Xu9xzwNqo+APGDYAYg5m344gu9/9FHKgkE9P3u3U3++vvz83XcHzrV2HbagP61xoVCIaUk125Lfvb55+rZvbu+27VLFRUVTV4fgPhBMAMQ8yKRiO6ePuPIAxto1erVuuzCC3XphSP0zZYtOqnniRo6+Kxa477fvVv/509/0pAzz9SPe/eqtLRUe378UU8tfE6PPzRTD98/Q8veeEN79++XPc2u4zp1Uvv27TR95kPNVjuA2EIwA4AjeH7xEtlT0/SX4cN18d/+prXrN+h/739Aj896qMa4F5a+pN8fc4wmjB2jlJQUffHVVxo7cZLyCwp0zdixuvLiS3T15ZcrMyNDxX6/dn6/SyvefdeYSQEwpYQzcnLrf5UsAAAAmg23ywAAADAJghkAAIBJEMwAAABMgmAGAABgEgQzAAAAkyCYAQAAmATBDAAAwCQIZgAAACZBMAMAADCJ/weV7vWwa6u/sAAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig, ax = plt.subplots(figsize = (10,5))\n", "fig.set_facecolor('#3d4849')\n", "ax.patch.set_facecolor('#3d4849')\n", "\n", "#set up our base layer\n", "mpl.rcParams['xtick.color'] = 'white'\n", "mpl.rcParams['ytick.color'] = 'white'\n", "\n", "ax.grid(ls='dotted',lw=.5,color='lightgrey',axis='y',zorder=1)\n", "spines = ['top','bottom','left','right']\n", "for x in spines:\n", " if x in spines:\n", " ax.spines[x].set_visible(False)\n", " \n", "plt.xticks([0,15,30,45,60,75,90])\n", "plt.xlabel('Minute',fontname='Andale Mono',color='white',fontsize=16)\n", "plt.ylabel('xG',fontname='Andale Mono',color='white',fontsize=16)\n", "\n", "#plot the step graphs\n", "ax.step(x=a_min,y=a_cumulative,color='#d3d3d3',label=ateam,linewidth=5,where='post')\n", "ax.step(x=h_min,y=h_cumulative,color='#fd3607',label=ateam,linewidth=5,where='post')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }