{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Stats Project - Soccer\n",
"\n",
"#### by Flor Nightgale\n",
"\n",
"For this project we used secondary data about [Premier League (Soccer)](https://www.premierleague.com/tables).\n",
"\n",
"## Team Statistics"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" 2020-2021 | \n",
" GP | \n",
" W | \n",
" D | \n",
" L | \n",
" F | \n",
" A | \n",
" GD | \n",
" P | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1LEILeicester City | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 2 | \n",
" 5 | \n",
" 6 | \n",
"
\n",
" \n",
" 1 | \n",
" 2EVEEverton | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 2 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 2 | \n",
" 3ARSArsenal | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 3 | \n",
" 4LIVLiverpool | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 3 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 4 | \n",
" 5CRYCrystal Palace | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 1 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 5 | \n",
" 6TOTTottenham Hotspur | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 5 | \n",
" 3 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 6 | \n",
" 7MNCManchester City | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 3 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 7 | \n",
" 8BHABrighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 4 | \n",
" 3 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 8 | \n",
" 9AVLAston Villa | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 9 | \n",
" 10LEELeeds United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 7 | \n",
" 7 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 10 | \n",
" 11CHEChelsea | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 11 | \n",
" 12WOLWolverhampton Wanderers | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 12 | \n",
" 13NEWNewcastle United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" -1 | \n",
" 3 | \n",
"
\n",
" \n",
" 13 | \n",
" 14BURBurnley | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 4 | \n",
" -2 | \n",
" 0 | \n",
"
\n",
" \n",
" 14 | \n",
" 15MANManchester United | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
" 3 | \n",
" -2 | \n",
" 0 | \n",
"
\n",
" \n",
" 15 | \n",
" 16WHUWest Ham United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 1 | \n",
" 4 | \n",
" -3 | \n",
" 0 | \n",
"
\n",
" \n",
" 16 | \n",
" 17SHUSheffield United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 3 | \n",
" -3 | \n",
" 0 | \n",
"
\n",
" \n",
" 17 | \n",
" 18FULFulham | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 3 | \n",
" 7 | \n",
" -4 | \n",
" 0 | \n",
"
\n",
" \n",
" 18 | \n",
" 19SOUTSouthampton | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 6 | \n",
" -4 | \n",
" 0 | \n",
"
\n",
" \n",
" 19 | \n",
" 20WBAWest Bromwich Albion | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 8 | \n",
" -6 | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" 2020-2021 GP W D L F A GD P\n",
"0 1LEILeicester City 2 2 0 0 7 2 5 6\n",
"1 2EVEEverton 2 2 0 0 6 2 4 6\n",
"2 3ARSArsenal 2 2 0 0 5 1 4 6\n",
"3 4LIVLiverpool 2 2 0 0 6 3 3 6\n",
"4 5CRYCrystal Palace 2 2 0 0 4 1 3 6\n",
"5 6TOTTottenham Hotspur 2 1 0 1 5 3 2 3\n",
"6 7MNCManchester City 1 1 0 0 3 1 2 3\n",
"7 8BHABrighton & Hove Albion 2 1 0 1 4 3 1 3\n",
"8 9AVLAston Villa 1 1 0 0 1 0 1 3\n",
"9 10LEELeeds United 2 1 0 1 7 7 0 3\n",
"10 11CHEChelsea 2 1 0 1 3 3 0 3\n",
"11 12WOLWolverhampton Wanderers 2 1 0 1 3 3 0 3\n",
"12 13NEWNewcastle United 2 1 0 1 2 3 -1 3\n",
"13 14BURBurnley 1 0 0 1 2 4 -2 0\n",
"14 15MANManchester United 1 0 0 1 1 3 -2 0\n",
"15 16WHUWest Ham United 2 0 0 2 1 4 -3 0\n",
"16 17SHUSheffield United 2 0 0 2 0 3 -3 0\n",
"17 18FULFulham 2 0 0 2 3 7 -4 0\n",
"18 19SOUTSouthampton 2 0 0 2 2 6 -4 0\n",
"19 20WBAWest Bromwich Albion 2 0 0 2 2 8 -6 0"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"data = pd.read_html('https://www.espn.com/soccer/table/_/league/eng.1')\n",
"teams = data[0].join(data[1]) # join the two data tables together\n",
"teams"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Columns in the data set are:\n",
"* GP: Games Played\n",
"* W: Wins\n",
"* D: Draws\n",
"* L: Losses\n",
"* F: Goals For\n",
"* A: Goals Against\n",
"* GD: Goal Difference\n",
"* P: Points\n",
"\n",
"Notice that the ranking (index values) start at zero. As well, the team names got combined with their ranks and abbreviations, let's cut those out and leave just the team names.\n",
"\n",
"For each team name, the second character is a lowercase letter, so we'll find the first lowercase letter then take just the characters from one before that until the end of the name.\n",
"\n",
"We'll also rename the columns."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Team | \n",
" Games Played | \n",
" Wins | \n",
" Draws | \n",
" Losses | \n",
" Goals For | \n",
" Goals Against | \n",
" Goal Difference | \n",
" Points | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Leicester City | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 2 | \n",
" 5 | \n",
" 6 | \n",
"
\n",
" \n",
" 1 | \n",
" Everton | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 2 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 2 | \n",
" Arsenal | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 3 | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 3 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 4 | \n",
" Crystal Palace | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 1 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 5 | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 5 | \n",
" 3 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 6 | \n",
" Manchester City | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 3 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 7 | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 4 | \n",
" 3 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 8 | \n",
" Aston Villa | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 9 | \n",
" Leeds United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 7 | \n",
" 7 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 10 | \n",
" Chelsea | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 11 | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 12 | \n",
" Newcastle United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" -1 | \n",
" 3 | \n",
"
\n",
" \n",
" 13 | \n",
" Burnley | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 4 | \n",
" -2 | \n",
" 0 | \n",
"
\n",
" \n",
" 14 | \n",
" Manchester United | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
" 3 | \n",
" -2 | \n",
" 0 | \n",
"
\n",
" \n",
" 15 | \n",
" West Ham United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 1 | \n",
" 4 | \n",
" -3 | \n",
" 0 | \n",
"
\n",
" \n",
" 16 | \n",
" Sheffield United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 3 | \n",
" -3 | \n",
" 0 | \n",
"
\n",
" \n",
" 17 | \n",
" Fulham | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 3 | \n",
" 7 | \n",
" -4 | \n",
" 0 | \n",
"
\n",
" \n",
" 18 | \n",
" Southampton | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 6 | \n",
" -4 | \n",
" 0 | \n",
"
\n",
" \n",
" 19 | \n",
" West Bromwich Albion | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 8 | \n",
" -6 | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Team Games Played Wins Draws Losses Goals For \\\n",
"0 Leicester City 2 2 0 0 7 \n",
"1 Everton 2 2 0 0 6 \n",
"2 Arsenal 2 2 0 0 5 \n",
"3 Liverpool 2 2 0 0 6 \n",
"4 Crystal Palace 2 2 0 0 4 \n",
"5 Tottenham Hotspur 2 1 0 1 5 \n",
"6 Manchester City 1 1 0 0 3 \n",
"7 Brighton & Hove Albion 2 1 0 1 4 \n",
"8 Aston Villa 1 1 0 0 1 \n",
"9 Leeds United 2 1 0 1 7 \n",
"10 Chelsea 2 1 0 1 3 \n",
"11 Wolverhampton Wanderers 2 1 0 1 3 \n",
"12 Newcastle United 2 1 0 1 2 \n",
"13 Burnley 1 0 0 1 2 \n",
"14 Manchester United 1 0 0 1 1 \n",
"15 West Ham United 2 0 0 2 1 \n",
"16 Sheffield United 2 0 0 2 0 \n",
"17 Fulham 2 0 0 2 3 \n",
"18 Southampton 2 0 0 2 2 \n",
"19 West Bromwich Albion 2 0 0 2 2 \n",
"\n",
" Goals Against Goal Difference Points \n",
"0 2 5 6 \n",
"1 2 4 6 \n",
"2 1 4 6 \n",
"3 3 3 6 \n",
"4 1 3 6 \n",
"5 3 2 3 \n",
"6 1 2 3 \n",
"7 3 1 3 \n",
"8 0 1 3 \n",
"9 7 0 3 \n",
"10 3 0 3 \n",
"11 3 0 3 \n",
"12 3 -1 3 \n",
"13 4 -2 0 \n",
"14 3 -2 0 \n",
"15 4 -3 0 \n",
"16 3 -3 0 \n",
"17 7 -4 0 \n",
"18 6 -4 0 \n",
"19 8 -6 0 "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for i, row in teams.iterrows():\n",
" for character in row[0]:\n",
" if character.islower(): # we've found the first lowercase letter\n",
" start_here = row[0].index(character)-1\n",
" team_name = row[0][start_here:]\n",
" break # stop looking through the team name\n",
" teams.iloc[i,0] = team_name\n",
"teams.columns = ['Team','Games Played','Wins','Draws','Losses','Goals For','Goals Against','Goal Difference','Points']\n",
"teams"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Statistical Calculations\n",
"\n",
"The `describe()` method does some statisical calculations for us."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Games Played | \n",
" Wins | \n",
" Draws | \n",
" Losses | \n",
" Goals For | \n",
" Goals Against | \n",
" Goal Difference | \n",
" Points | \n",
"
\n",
" \n",
" \n",
" \n",
" count | \n",
" 20.000000 | \n",
" 20.000000 | \n",
" 20.0 | \n",
" 20.000000 | \n",
" 20.000000 | \n",
" 20.000000 | \n",
" 20.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" mean | \n",
" 1.800000 | \n",
" 0.900000 | \n",
" 0.0 | \n",
" 0.900000 | \n",
" 3.350000 | \n",
" 3.350000 | \n",
" 0.000000 | \n",
" 2.700000 | \n",
"
\n",
" \n",
" std | \n",
" 0.410391 | \n",
" 0.788069 | \n",
" 0.0 | \n",
" 0.788069 | \n",
" 2.084403 | \n",
" 2.158825 | \n",
" 3.077935 | \n",
" 2.364207 | \n",
"
\n",
" \n",
" min | \n",
" 1.000000 | \n",
" 0.000000 | \n",
" 0.0 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
" -6.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" 25% | \n",
" 2.000000 | \n",
" 0.000000 | \n",
" 0.0 | \n",
" 0.000000 | \n",
" 2.000000 | \n",
" 2.000000 | \n",
" -2.250000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" 50% | \n",
" 2.000000 | \n",
" 1.000000 | \n",
" 0.0 | \n",
" 1.000000 | \n",
" 3.000000 | \n",
" 3.000000 | \n",
" 0.000000 | \n",
" 3.000000 | \n",
"
\n",
" \n",
" 75% | \n",
" 2.000000 | \n",
" 1.250000 | \n",
" 0.0 | \n",
" 1.250000 | \n",
" 5.000000 | \n",
" 4.000000 | \n",
" 2.250000 | \n",
" 3.750000 | \n",
"
\n",
" \n",
" max | \n",
" 2.000000 | \n",
" 2.000000 | \n",
" 0.0 | \n",
" 2.000000 | \n",
" 7.000000 | \n",
" 8.000000 | \n",
" 5.000000 | \n",
" 6.000000 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Games Played Wins Draws Losses Goals For Goals Against \\\n",
"count 20.000000 20.000000 20.0 20.000000 20.000000 20.000000 \n",
"mean 1.800000 0.900000 0.0 0.900000 3.350000 3.350000 \n",
"std 0.410391 0.788069 0.0 0.788069 2.084403 2.158825 \n",
"min 1.000000 0.000000 0.0 0.000000 0.000000 0.000000 \n",
"25% 2.000000 0.000000 0.0 0.000000 2.000000 2.000000 \n",
"50% 2.000000 1.000000 0.0 1.000000 3.000000 3.000000 \n",
"75% 2.000000 1.250000 0.0 1.250000 5.000000 4.000000 \n",
"max 2.000000 2.000000 0.0 2.000000 7.000000 8.000000 \n",
"\n",
" Goal Difference Points \n",
"count 20.000000 20.000000 \n",
"mean 0.000000 2.700000 \n",
"std 3.077935 2.364207 \n",
"min -6.000000 0.000000 \n",
"25% -2.250000 0.000000 \n",
"50% 0.000000 3.000000 \n",
"75% 2.250000 3.750000 \n",
"max 5.000000 6.000000 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"team_stats = teams.describe()\n",
"team_stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also find the median values."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Games Played 2.0\n",
"Wins 1.0\n",
"Draws 0.0\n",
"Losses 1.0\n",
"Goals For 3.0\n",
"Goals Against 3.0\n",
"Goal Difference 0.0\n",
"Points 3.0\n",
"dtype: float64"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.median()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `Goal Difference` column is probably the most interesting, since it has the largest range and highest standard deviation. The top teams scored a lot more than they were scored on, and the bottom teams were scored on a lot more than they scored.\n",
"\n",
"\n",
"\n",
"Since we are looking at data for all of the teams, we see that the mean number of wins is equal to the mean number of losses. The same goes for goals scored and goals scored against.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"alignmentgroup": "True",
"hovertemplate": "index=%{x}
Goal Difference=%{y}",
"legendgroup": "",
"marker": {
"color": "#636efa"
},
"name": "",
"offsetgroup": "",
"orientation": "v",
"showlegend": false,
"textposition": "auto",
"type": "bar",
"x": [
"min",
"25%",
"50%",
"75%",
"max"
],
"xaxis": "x",
"y": [
-6,
-2.25,
0,
2.25,
5
],
"yaxis": "y"
}
],
"layout": {
"barmode": "relative",
"legend": {
"tracegroupgap": 0
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "index"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "Goal Difference"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly_express as px\n",
"fig = px.bar(team_stats.iloc[3:], y='Goal Difference', title='')\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If we want to see which teams scored more than the mean value of \"Goals For\", we can use the following code."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Team | \n",
" Games Played | \n",
" Wins | \n",
" Draws | \n",
" Losses | \n",
" Goals For | \n",
" Goals Against | \n",
" Goal Difference | \n",
" Points | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Leicester City | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 2 | \n",
" 5 | \n",
" 6 | \n",
"
\n",
" \n",
" 1 | \n",
" Everton | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 2 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 2 | \n",
" Arsenal | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 3 | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 3 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 4 | \n",
" Crystal Palace | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 1 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 5 | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 5 | \n",
" 3 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 7 | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 4 | \n",
" 3 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 9 | \n",
" Leeds United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 7 | \n",
" 7 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Team Games Played Wins Draws Losses Goals For \\\n",
"0 Leicester City 2 2 0 0 7 \n",
"1 Everton 2 2 0 0 6 \n",
"2 Arsenal 2 2 0 0 5 \n",
"3 Liverpool 2 2 0 0 6 \n",
"4 Crystal Palace 2 2 0 0 4 \n",
"5 Tottenham Hotspur 2 1 0 1 5 \n",
"7 Brighton & Hove Albion 2 1 0 1 4 \n",
"9 Leeds United 2 1 0 1 7 \n",
"\n",
" Goals Against Goal Difference Points \n",
"0 2 5 6 \n",
"1 2 4 6 \n",
"2 1 4 6 \n",
"3 3 3 6 \n",
"4 1 3 6 \n",
"5 3 2 3 \n",
"7 3 1 3 \n",
"9 7 0 3 "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gf_mean = teams['Goals For'].mean()\n",
"teams[teams['Goals For'] > gf_mean]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In general, but not always, the top teams scored more than the average number of goals.\n",
"\n",
"Mean is probably the best measure of central tendency here, since using the median would just give us the top half of the teams. Mode wouldn't be useful because there aren't a lot of repeated values in the column.\n",
"\n",
"Let's see if the top teams had fewer than the mean number of goals scored against them."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Team | \n",
" Games Played | \n",
" Wins | \n",
" Draws | \n",
" Losses | \n",
" Goals For | \n",
" Goals Against | \n",
" Goal Difference | \n",
" Points | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Leicester City | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 2 | \n",
" 5 | \n",
" 6 | \n",
"
\n",
" \n",
" 1 | \n",
" Everton | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 2 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 2 | \n",
" Arsenal | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" 4 | \n",
" 6 | \n",
"
\n",
" \n",
" 3 | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 3 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 4 | \n",
" Crystal Palace | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 1 | \n",
" 3 | \n",
" 6 | \n",
"
\n",
" \n",
" 5 | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 5 | \n",
" 3 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 6 | \n",
" Manchester City | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 3 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 7 | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 4 | \n",
" 3 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 8 | \n",
" Aston Villa | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 10 | \n",
" Chelsea | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 11 | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
"
\n",
" \n",
" 12 | \n",
" Newcastle United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" -1 | \n",
" 3 | \n",
"
\n",
" \n",
" 14 | \n",
" Manchester United | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
" 3 | \n",
" -2 | \n",
" 0 | \n",
"
\n",
" \n",
" 16 | \n",
" Sheffield United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 3 | \n",
" -3 | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Team Games Played Wins Draws Losses Goals For \\\n",
"0 Leicester City 2 2 0 0 7 \n",
"1 Everton 2 2 0 0 6 \n",
"2 Arsenal 2 2 0 0 5 \n",
"3 Liverpool 2 2 0 0 6 \n",
"4 Crystal Palace 2 2 0 0 4 \n",
"5 Tottenham Hotspur 2 1 0 1 5 \n",
"6 Manchester City 1 1 0 0 3 \n",
"7 Brighton & Hove Albion 2 1 0 1 4 \n",
"8 Aston Villa 1 1 0 0 1 \n",
"10 Chelsea 2 1 0 1 3 \n",
"11 Wolverhampton Wanderers 2 1 0 1 3 \n",
"12 Newcastle United 2 1 0 1 2 \n",
"14 Manchester United 1 0 0 1 1 \n",
"16 Sheffield United 2 0 0 2 0 \n",
"\n",
" Goals Against Goal Difference Points \n",
"0 2 5 6 \n",
"1 2 4 6 \n",
"2 1 4 6 \n",
"3 3 3 6 \n",
"4 1 3 6 \n",
"5 3 2 3 \n",
"6 1 2 3 \n",
"7 3 1 3 \n",
"8 0 1 3 \n",
"10 3 0 3 \n",
"11 3 0 3 \n",
"12 3 -1 3 \n",
"14 3 -2 0 \n",
"16 3 -3 0 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ga_mean = teams['Goals Against'].mean()\n",
"teams[teams['Goals Against'] < gf_mean]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Again, it is generally true that the top teams that had fewer goals scored against them.\n",
"\n",
"### Teams Visualizations\n",
"\n",
"Let's create some plots of `Wins`, `Losses`, `Draws` versus team rank."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"customdata": [
[
"Leicester City"
],
[
"Everton"
],
[
"Arsenal"
],
[
"Liverpool"
],
[
"Crystal Palace"
],
[
"Tottenham Hotspur"
],
[
"Manchester City"
],
[
"Brighton & Hove Albion"
],
[
"Aston Villa"
],
[
"Leeds United"
],
[
"Chelsea"
],
[
"Wolverhampton Wanderers"
],
[
"Newcastle United"
],
[
"Burnley"
],
[
"Manchester United"
],
[
"West Ham United"
],
[
"Sheffield United"
],
[
"Fulham"
],
[
"Southampton"
],
[
"West Bromwich Albion"
]
],
"hovertemplate": "index=%{x}
Wins=%{y}
Team=%{customdata[0]}",
"legendgroup": "",
"marker": {
"color": "#636efa",
"symbol": "circle"
},
"mode": "markers",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"xaxis": "x",
"y": [
2,
2,
2,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Wins vs Rank"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "index"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "Wins"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"customdata": [
[
"Leicester City"
],
[
"Everton"
],
[
"Arsenal"
],
[
"Liverpool"
],
[
"Crystal Palace"
],
[
"Tottenham Hotspur"
],
[
"Manchester City"
],
[
"Brighton & Hove Albion"
],
[
"Aston Villa"
],
[
"Leeds United"
],
[
"Chelsea"
],
[
"Wolverhampton Wanderers"
],
[
"Newcastle United"
],
[
"Burnley"
],
[
"Manchester United"
],
[
"West Ham United"
],
[
"Sheffield United"
],
[
"Fulham"
],
[
"Southampton"
],
[
"West Bromwich Albion"
]
],
"hovertemplate": "index=%{x}
Losses=%{y}
Team=%{customdata[0]}",
"legendgroup": "",
"marker": {
"color": "#636efa",
"symbol": "circle"
},
"mode": "markers",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"xaxis": "x",
"y": [
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Losses vs Rank"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "index"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "Losses"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"customdata": [
[
"Leicester City"
],
[
"Everton"
],
[
"Arsenal"
],
[
"Liverpool"
],
[
"Crystal Palace"
],
[
"Tottenham Hotspur"
],
[
"Manchester City"
],
[
"Brighton & Hove Albion"
],
[
"Aston Villa"
],
[
"Leeds United"
],
[
"Chelsea"
],
[
"Wolverhampton Wanderers"
],
[
"Newcastle United"
],
[
"Burnley"
],
[
"Manchester United"
],
[
"West Ham United"
],
[
"Sheffield United"
],
[
"Fulham"
],
[
"Southampton"
],
[
"West Bromwich Albion"
]
],
"hovertemplate": "index=%{x}
Draws=%{y}
Team=%{customdata[0]}",
"legendgroup": "",
"marker": {
"color": "#636efa",
"symbol": "circle"
},
"mode": "markers",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"xaxis": "x",
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Draws vs Rank"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "index"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "Draws"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"columns = ['Wins', 'Losses', 'Draws']\n",
"for column in columns:\n",
" fig = px.scatter(teams, x=teams.index, y=column, title=column+' vs Rank', hover_data=['Team'])\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Player Data\n",
"\n",
"We are also going to look at individual player data for scoring and assists. We'll download both and then look first at the top 10, `head(10)`, of the `scorers` data table."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" RK | \n",
" Name | \n",
" Team | \n",
" P | \n",
" G | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1.0 | \n",
" Dominic Calvert-Lewin | \n",
" Everton | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 1 | \n",
" NaN | \n",
" Son Heung-Min | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 2 | \n",
" 3.0 | \n",
" Mohamed Salah | \n",
" Liverpool | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 3 | \n",
" NaN | \n",
" Wilfried Zaha | \n",
" Crystal Palace | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 4 | \n",
" 5.0 | \n",
" Hélder Costa | \n",
" Leeds United | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 5 | \n",
" NaN | \n",
" Aleksandar Mitrovic | \n",
" Fulham | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 6 | \n",
" NaN | \n",
" Neal Maupay | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 7 | \n",
" NaN | \n",
" Sadio Mané | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 8 | \n",
" NaN | \n",
" Patrick Bamford | \n",
" Leeds United | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 9 | \n",
" NaN | \n",
" Raúl Jiménez | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" RK Name Team P G\n",
"0 1.0 Dominic Calvert-Lewin Everton 2 4\n",
"1 NaN Son Heung-Min Tottenham Hotspur 2 4\n",
"2 3.0 Mohamed Salah Liverpool 2 3\n",
"3 NaN Wilfried Zaha Crystal Palace 2 3\n",
"4 5.0 Hélder Costa Leeds United 2 2\n",
"5 NaN Aleksandar Mitrovic Fulham 2 2\n",
"6 NaN Neal Maupay Brighton & Hove Albion 2 2\n",
"7 NaN Sadio Mané Liverpool 2 2\n",
"8 NaN Patrick Bamford Leeds United 2 2\n",
"9 NaN Raúl Jiménez Wolverhampton Wanderers 2 2"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stats = pd.read_html('https://www.espn.com/soccer/stats/_/league/ENG.1/view/scoring')\n",
"scorers = stats[0]\n",
"assists = stats[1]\n",
"scorers.head(10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Columns:\n",
"* RK: Ranking\n",
"* P: Games played\n",
"* G: Goals scored\n",
"* A: Assists\n",
"\n",
"There are quite a few missing (`NaN`) values, which means that player is tied with the player above them, so we can use `fillna(method='ffill')` which means \"forward fill\" values to replace missing values."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" RK | \n",
" Name | \n",
" Team | \n",
" P | \n",
" G | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1.0 | \n",
" Dominic Calvert-Lewin | \n",
" Everton | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 1 | \n",
" 1.0 | \n",
" Son Heung-Min | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 2 | \n",
" 3.0 | \n",
" Mohamed Salah | \n",
" Liverpool | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 3 | \n",
" 3.0 | \n",
" Wilfried Zaha | \n",
" Crystal Palace | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 4 | \n",
" 5.0 | \n",
" Hélder Costa | \n",
" Leeds United | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 5 | \n",
" 5.0 | \n",
" Aleksandar Mitrovic | \n",
" Fulham | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 6 | \n",
" 5.0 | \n",
" Neal Maupay | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 7 | \n",
" 5.0 | \n",
" Sadio Mané | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 8 | \n",
" 5.0 | \n",
" Patrick Bamford | \n",
" Leeds United | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 9 | \n",
" 5.0 | \n",
" Raúl Jiménez | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" RK Name Team P G\n",
"0 1.0 Dominic Calvert-Lewin Everton 2 4\n",
"1 1.0 Son Heung-Min Tottenham Hotspur 2 4\n",
"2 3.0 Mohamed Salah Liverpool 2 3\n",
"3 3.0 Wilfried Zaha Crystal Palace 2 3\n",
"4 5.0 Hélder Costa Leeds United 2 2\n",
"5 5.0 Aleksandar Mitrovic Fulham 2 2\n",
"6 5.0 Neal Maupay Brighton & Hove Albion 2 2\n",
"7 5.0 Sadio Mané Liverpool 2 2\n",
"8 5.0 Patrick Bamford Leeds United 2 2\n",
"9 5.0 Raúl Jiménez Wolverhampton Wanderers 2 2"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scorers = scorers.fillna(method='ffill')\n",
"scorers.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" RK | \n",
" Name | \n",
" Team | \n",
" P | \n",
" A | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1.0 | \n",
" Harry Kane | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 1 | \n",
" 2.0 | \n",
" Daniel Podence | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 2 | \n",
" 2.0 | \n",
" Willian | \n",
" Arsenal | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 3 | \n",
" 2.0 | \n",
" Richarlison | \n",
" Everton | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" 4 | \n",
" 5.0 | \n",
" Tariq Lamptey | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" RK Name Team P A\n",
"0 1.0 Harry Kane Tottenham Hotspur 2 4\n",
"1 2.0 Daniel Podence Wolverhampton Wanderers 2 2\n",
"2 2.0 Willian Arsenal 2 2\n",
"3 2.0 Richarlison Everton 2 2\n",
"4 5.0 Tariq Lamptey Brighton & Hove Albion 2 1"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"assists = assists.fillna(method='ffill')\n",
"assists.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's create histograms for these two data sets."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"alignmentgroup": "True",
"bingroup": "x",
"hovertemplate": "G=%{x}
count=%{y}",
"legendgroup": "",
"marker": {
"color": "#636efa"
},
"name": "",
"offsetgroup": "",
"orientation": "v",
"showlegend": false,
"type": "histogram",
"x": [
4,
4,
3,
3,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0
],
"xaxis": "x",
"yaxis": "y"
}
],
"layout": {
"barmode": "relative",
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Histogram of Goals Scored by Top Players"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "G"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "count"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"alignmentgroup": "True",
"bingroup": "x",
"hovertemplate": "A=%{x}
count=%{y}",
"legendgroup": "",
"marker": {
"color": "#636efa"
},
"name": "",
"offsetgroup": "",
"orientation": "v",
"showlegend": false,
"type": "histogram",
"x": [
4,
2,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"xaxis": "x",
"yaxis": "y"
}
],
"layout": {
"barmode": "relative",
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Histogram of Assists by Top Players"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "A"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "count"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig1 = px.histogram(scorers, x='G', title='Histogram of Goals Scored by Top Players')\n",
"fig1.show()\n",
"fig2 = px.histogram(assists, x='A', title='Histogram of Assists by Top Players')\n",
"fig2.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Both of these histograms show that there are many more players that scored (or assisted) fewer goals, so the data are not normally distributed."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Research Question\n",
"\n",
"**Does having more top scoring or top assisting players on a team mean that team has a higher standing?**\n",
"\n",
"To answer this question, we will need to group the player data by team and merge the two data tables together. We'll also drop the columns that we don't need."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Team | \n",
" G | \n",
" A | \n",
" Goals and Assists | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Leeds United | \n",
" 5 | \n",
" 5 | \n",
" 10 | \n",
"
\n",
" \n",
" 1 | \n",
" Brighton & Hove Albion | \n",
" 4 | \n",
" 5 | \n",
" 9 | \n",
"
\n",
" \n",
" 2 | \n",
" Arsenal | \n",
" 4 | \n",
" 4 | \n",
" 8 | \n",
"
\n",
" \n",
" 3 | \n",
" Leicester City | \n",
" 5 | \n",
" 3 | \n",
" 8 | \n",
"
\n",
" \n",
" 4 | \n",
" Crystal Palace | \n",
" 3 | \n",
" 4 | \n",
" 7 | \n",
"
\n",
" \n",
" 5 | \n",
" Everton | \n",
" 3 | \n",
" 4 | \n",
" 7 | \n",
"
\n",
" \n",
" 6 | \n",
" Chelsea | \n",
" 3 | \n",
" 2 | \n",
" 5 | \n",
"
\n",
" \n",
" 7 | \n",
" Liverpool | \n",
" 3 | \n",
" 2 | \n",
" 5 | \n",
"
\n",
" \n",
" 8 | \n",
" Manchester City | \n",
" 3 | \n",
" 2 | \n",
" 5 | \n",
"
\n",
" \n",
" 9 | \n",
" Newcastle United | \n",
" 2 | \n",
" 3 | \n",
" 5 | \n",
"
\n",
" \n",
" 10 | \n",
" Southampton | \n",
" 2 | \n",
" 3 | \n",
" 5 | \n",
"
\n",
" \n",
" 11 | \n",
" West Bromwich Albion | \n",
" 2 | \n",
" 3 | \n",
" 5 | \n",
"
\n",
" \n",
" 12 | \n",
" Fulham | \n",
" 2 | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 13 | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 14 | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 2 | \n",
" 4 | \n",
"
\n",
" \n",
" 15 | \n",
" Burnley | \n",
" 2 | \n",
" 1 | \n",
" 3 | \n",
"
\n",
" \n",
" 16 | \n",
" West Ham United | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" 17 | \n",
" Aston Villa | \n",
" 1 | \n",
" 1 | \n",
" 2 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Team G A Goals and Assists\n",
"0 Leeds United 5 5 10\n",
"1 Brighton & Hove Albion 4 5 9\n",
"2 Arsenal 4 4 8\n",
"3 Leicester City 5 3 8\n",
"4 Crystal Palace 3 4 7\n",
"5 Everton 3 4 7\n",
"6 Chelsea 3 2 5\n",
"7 Liverpool 3 2 5\n",
"8 Manchester City 3 2 5\n",
"9 Newcastle United 2 3 5\n",
"10 Southampton 2 3 5\n",
"11 West Bromwich Albion 2 3 5\n",
"12 Fulham 2 2 4\n",
"13 Tottenham Hotspur 2 2 4\n",
"14 Wolverhampton Wanderers 2 2 4\n",
"15 Burnley 2 1 3\n",
"16 West Ham United 1 2 3\n",
"17 Aston Villa 1 1 2"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# group the data by team\n",
"scorers_team = scorers.groupby('Team').count().drop(columns=['RK', 'Name', 'P'])\n",
"assists_team = assists.groupby('Team').count().drop(columns=['RK', 'Name', 'P'])\n",
"# merge the players data tables\n",
"players = scorers_team.merge(assists_team, on='Team')\n",
"# create a column that adds goals and assists\n",
"players['Goals and Assists'] = players['G']+players['A']\n",
"# sort the values, create an index column, and display the data\n",
"players = players.sort_values('Goals and Assists', ascending=False).reset_index()\n",
"players"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we need to merge this data table with the `Teams` data table from earlier."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Team | \n",
" Games Played | \n",
" Wins | \n",
" Draws | \n",
" Losses | \n",
" Goals For | \n",
" Goals Against | \n",
" Goal Difference | \n",
" Points | \n",
" G | \n",
" A | \n",
" Goals and Assists | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Leicester City | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 2 | \n",
" 5 | \n",
" 6 | \n",
" 5.0 | \n",
" 3.0 | \n",
" 8.0 | \n",
"
\n",
" \n",
" 1 | \n",
" Everton | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 2 | \n",
" 4 | \n",
" 6 | \n",
" 3.0 | \n",
" 4.0 | \n",
" 7.0 | \n",
"
\n",
" \n",
" 2 | \n",
" Arsenal | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" 4 | \n",
" 6 | \n",
" 4.0 | \n",
" 4.0 | \n",
" 8.0 | \n",
"
\n",
" \n",
" 3 | \n",
" Liverpool | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 3 | \n",
" 3 | \n",
" 6 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
" 4 | \n",
" Crystal Palace | \n",
" 2 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 1 | \n",
" 3 | \n",
" 6 | \n",
" 3.0 | \n",
" 4.0 | \n",
" 7.0 | \n",
"
\n",
" \n",
" 5 | \n",
" Tottenham Hotspur | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 5 | \n",
" 3 | \n",
" 2 | \n",
" 3 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
"
\n",
" \n",
" 6 | \n",
" Manchester City | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 3 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
" 7 | \n",
" Brighton & Hove Albion | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 4 | \n",
" 3 | \n",
" 1 | \n",
" 3 | \n",
" 4.0 | \n",
" 5.0 | \n",
" 9.0 | \n",
"
\n",
" \n",
" 8 | \n",
" Aston Villa | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
"
\n",
" \n",
" 9 | \n",
" Leeds United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 7 | \n",
" 7 | \n",
" 0 | \n",
" 3 | \n",
" 5.0 | \n",
" 5.0 | \n",
" 10.0 | \n",
"
\n",
" \n",
" 10 | \n",
" Chelsea | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
" 11 | \n",
" Wolverhampton Wanderers | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 3 | \n",
" 3 | \n",
" 0 | \n",
" 3 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
"
\n",
" \n",
" 12 | \n",
" Newcastle United | \n",
" 2 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" -1 | \n",
" 3 | \n",
" 2.0 | \n",
" 3.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
" 13 | \n",
" Burnley | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 4 | \n",
" -2 | \n",
" 0 | \n",
" 2.0 | \n",
" 1.0 | \n",
" 3.0 | \n",
"
\n",
" \n",
" 14 | \n",
" Manchester United | \n",
" 1 | \n",
" 0 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
" 3 | \n",
" -2 | \n",
" 0 | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 15 | \n",
" West Ham United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 1 | \n",
" 4 | \n",
" -3 | \n",
" 0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 3.0 | \n",
"
\n",
" \n",
" 16 | \n",
" Sheffield United | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 3 | \n",
" -3 | \n",
" 0 | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 17 | \n",
" Fulham | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 3 | \n",
" 7 | \n",
" -4 | \n",
" 0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
"
\n",
" \n",
" 18 | \n",
" Southampton | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 6 | \n",
" -4 | \n",
" 0 | \n",
" 2.0 | \n",
" 3.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
" 19 | \n",
" West Bromwich Albion | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
" 8 | \n",
" -6 | \n",
" 0 | \n",
" 2.0 | \n",
" 3.0 | \n",
" 5.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Team Games Played Wins Draws Losses Goals For \\\n",
"0 Leicester City 2 2 0 0 7 \n",
"1 Everton 2 2 0 0 6 \n",
"2 Arsenal 2 2 0 0 5 \n",
"3 Liverpool 2 2 0 0 6 \n",
"4 Crystal Palace 2 2 0 0 4 \n",
"5 Tottenham Hotspur 2 1 0 1 5 \n",
"6 Manchester City 1 1 0 0 3 \n",
"7 Brighton & Hove Albion 2 1 0 1 4 \n",
"8 Aston Villa 1 1 0 0 1 \n",
"9 Leeds United 2 1 0 1 7 \n",
"10 Chelsea 2 1 0 1 3 \n",
"11 Wolverhampton Wanderers 2 1 0 1 3 \n",
"12 Newcastle United 2 1 0 1 2 \n",
"13 Burnley 1 0 0 1 2 \n",
"14 Manchester United 1 0 0 1 1 \n",
"15 West Ham United 2 0 0 2 1 \n",
"16 Sheffield United 2 0 0 2 0 \n",
"17 Fulham 2 0 0 2 3 \n",
"18 Southampton 2 0 0 2 2 \n",
"19 West Bromwich Albion 2 0 0 2 2 \n",
"\n",
" Goals Against Goal Difference Points G A Goals and Assists \n",
"0 2 5 6 5.0 3.0 8.0 \n",
"1 2 4 6 3.0 4.0 7.0 \n",
"2 1 4 6 4.0 4.0 8.0 \n",
"3 3 3 6 3.0 2.0 5.0 \n",
"4 1 3 6 3.0 4.0 7.0 \n",
"5 3 2 3 2.0 2.0 4.0 \n",
"6 1 2 3 3.0 2.0 5.0 \n",
"7 3 1 3 4.0 5.0 9.0 \n",
"8 0 1 3 1.0 1.0 2.0 \n",
"9 7 0 3 5.0 5.0 10.0 \n",
"10 3 0 3 3.0 2.0 5.0 \n",
"11 3 0 3 2.0 2.0 4.0 \n",
"12 3 -1 3 2.0 3.0 5.0 \n",
"13 4 -2 0 2.0 1.0 3.0 \n",
"14 3 -2 0 NaN NaN NaN \n",
"15 4 -3 0 1.0 2.0 3.0 \n",
"16 3 -3 0 NaN NaN NaN \n",
"17 7 -4 0 2.0 2.0 4.0 \n",
"18 6 -4 0 2.0 3.0 5.0 \n",
"19 8 -6 0 2.0 3.0 5.0 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"combined_data = teams.merge(players, on='Team', how='left') # left means keep the order from the teams data table\n",
"combined_data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To see if there is a relationship between `Goals and Assists` and team rank, let's create another scatterplot."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"customdata": [
[
"Leicester City"
],
[
"Everton"
],
[
"Arsenal"
],
[
"Liverpool"
],
[
"Crystal Palace"
],
[
"Tottenham Hotspur"
],
[
"Manchester City"
],
[
"Brighton & Hove Albion"
],
[
"Aston Villa"
],
[
"Leeds United"
],
[
"Chelsea"
],
[
"Wolverhampton Wanderers"
],
[
"Newcastle United"
],
[
"Burnley"
],
[
"Manchester United"
],
[
"West Ham United"
],
[
"Sheffield United"
],
[
"Fulham"
],
[
"Southampton"
],
[
"West Bromwich Albion"
]
],
"hovertemplate": "index=%{x}
Goals and Assists=%{y}
Team=%{customdata[0]}",
"legendgroup": "",
"marker": {
"color": "#636efa",
"symbol": "circle"
},
"mode": "markers",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"xaxis": "x",
"y": [
8,
7,
8,
5,
7,
4,
5,
9,
2,
10,
5,
4,
5,
3,
null,
3,
null,
4,
5,
5
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Goals and Assists vs Team Rank"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "index"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "Goals and Assists"
}
}
}
},
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" \n",
"
"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = px.scatter(combined_data, y='Goals and Assists', x=combined_data.index, hover_data=['Team'], title='Goals and Assists vs Team Rank')\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conclusion\n",
"\n",
"It looks like higher ranked teams (lower $x$ values) tend to have more players with more goals and assists, although there is a fair amount of variation in the data.\n",
"\n",
"Perhaps we could look at a similar analysis using a larger data set from a league such as the [National Hockey League](https://www.nhl.com) where there are more games played by more teams."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[](https://github.com/callysto/curriculum-notebooks/blob/master/LICENSE.md)"
]
}
],
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}