{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The Fight for McLaren Dominance: Lewis Hamilton vs Fernando Alonso" ] }, { "cell_type": "markdown", "metadata": { "toc": true }, "source": [ "

Table of Contents

\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Project Overview\n", "\n", "I obtained this data from Kaggle, which can be found [here](https://www.kaggle.com/rohanrao/formula-1-world-championship-1950-2020)\n", "\n", "We'll be focusing on the main race on Sunday.\n", "\n", "In this project, I use different metrics to compare the two McLaren drivers in the 2007 season: Fernando Alonso (from Spain) and Lewis Hamilton (from the UK). A 2x world champion, Alonso has driven in F1 since 2001 and known to derive immense power from poorly engineered cars. Conversely, this is Hamilton's first season in Formula 1; he was previously racing in GP2 (a former F1 feeder).\n", "\n", "Hamilton (22 years old in 2007) is younger and therefore less experienced driver than Alonso (26 years in 2007), so we would expect Alonso to perform better.\n", "\n", "The metrics we'll be using to evaluate each driver will be their ability to:\n", " - Begin towards the front of the pack (good grid/starting positioning).\n", " - Maintaining/Improving their positioning in each lap of a given race.\n", " - Win races.\n", " - Win points.\n", " \n", "Wins and points will be more heavily weighted since these directly dictate a driver's standing in a season. However, grid and lap positioning heavily influence these two factors and can help undercover any nuances between drivers who have a similar number of wins/points." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "NOTE: The raw code for this notebook is by default hidden for easier reading.\n", "\n", "To toggle on/off the raw code, click here." ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "HTML('''\n", "\n", "NOTE: The raw code for this notebook is by default hidden for easier reading.\n", "\n", "To toggle on/off the raw code, click here.''')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Data Cleaning\n", "\n", "Data Cleaning mostly consisted of flagging outliers, setting place holders for missing values, checking consistency between related variables, and renaming columns. After the files were cleaned, I used SQL to join relevant fields from different tables and then made some final changes prior to this analysis." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. Preparation for Analysis\n", "\n", "We'll start out by importing the relevant libraries and data. Please note you won't see anything in this section unless you toggle on the raw code." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# import libraries\n", "import pandas as pd\n", "import numpy as np\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import plotly.express as px\n", "import plotly.graph_objects as go\n", "\n", "# load up datasets\n", "re = pd.read_pickle('final_data/agg_results')\n", "ham_2007 = pd.read_pickle('final_data/ham_results')\n", "ham_2007_lap = pd.read_pickle('final_data/lap_times')\n", "lap_all = pd.read_pickle('final_data/lap_times_all')\n", "ham_quali_2007 = pd.read_pickle('final_data/qualifying')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4. Grid Positioning" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Right before the actual race begins, all the drivers position themselves along the track. The order of this positioning is determined by each driver's performance in qualifying. We deem that one driver outperforms another in any given race if their grid positioning is better/ahead of their teammate's grid positioning. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Grid Position=%{x}
Number of Wins=%{y}", "legendgroup": "", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "", "orientation": "v", "showlegend": false, "type": "scatter", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 ], "xaxis": "x", "y": [ 392, 227, 118, 60, 46, 34, 19, 16, 4, 8, 5, 3, 2, 4, 1, 2, 2, 1, 0, 0, 0, 1, 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 }, "autotypenumbers": "strict", "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": "Relationship of Starting Position and Wins (1950-2017)" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "range": [ 0, 33 ], "title": { "text": "Grid Position" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Number of Wins" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# explore relationship between qualifying/grid positioning and wins/podiums/positions on aggregate level\n", "re_pos = re[['race', 'dname', 'position', 'grid']].copy()\n", "re_pos['win'] = (re_pos.position == 1).astype('int64')\n", "re_win_agg = re_pos.groupby(['grid'], as_index=False)['win'].sum()\n", "re_win_agg = re_win_agg.loc[re_win_agg['grid'] > 0 ,]\n", "\n", "fig = px.line(re_win_agg, x='grid', y='win', range_x=[0, 33], labels={'win': 'Number of Wins', 'grid': 'Grid Position'},\n", " title='Relationship of Starting Position and Wins (1950-2017)')\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the graph above, we see that final results are heavily influenced by grid (initial) positioning. The closer to first one starts, the more likely they'll finish towards first as well. \n", "\n", "From this point forward, all of our analysis will focus on the 2007 season." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "ham_2007_piv = ham_2007.copy()\n", "ham_2007_piv['race_date'] = ham_2007_piv['race_date'].astype('str')\n", "ham_2007_piv['race'] = ham_2007_piv['race_date'] + '_' + ham_2007_piv['race']\n", "ham_2007_piv = ham_2007_piv.pivot(index='race', columns='dname', values=['grid', 'position', 'points', 'fastestLapSpeed',\n", " 'fastestLapTime']).reset_index()\n", "\n", "# make pivoted version for easier analysis\n", "ham_2007_piv['race'] = ham_2007_piv['race'].str.split('_', n=1, expand=False)\n", "ham_2007_piv['race_date'] = pd.to_datetime(ham_2007_piv['race'].str[0])\n", "ham_2007_piv['race_'] = ham_2007_piv['race'].str[1]\n", "ham_2007_piv = ham_2007_piv[['race_date', 'race_', 'grid', 'position', 'points', 'fastestLapSpeed', 'fastestLapTime']]\n", "ham_2007_piv.rename(columns={'race_':'race'}, inplace=True)\n", "ham_2007_piv.sort_values(by=['race_date', 'race'], inplace=True)\n", "\n", "# create dataframe focusing on positioning\n", "ham_2007_piv_pos = ham_2007_piv[['race_date', 'race', 'position', 'grid']].copy()\n", "ham_2007_piv_pos['grid'] = ham_2007_piv_pos['grid'].astype('float')\n", "ham_2007_piv_pos['position'] = ham_2007_piv_pos['position'].astype('float')\n", "\n", "# number of positions behind first place\n", "ham_2007_piv_pos['alon_grid_from1'] = ham_2007_piv_pos['grid']['Fernando Alonso'] - 1\n", "ham_2007_piv_pos['ham_grid_from1'] = ham_2007_piv_pos['grid']['Lewis Hamilton'] - 1" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "#1C8356" }, "name": "Alonso", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "y": [ 1, 1, 3, 1, 0, 1, 1, 9, 2, 1, 5, 3, 0, 2, 1, 3, 3 ] }, { "marker": { "color": "#2E91E5" }, "name": "Hamilton", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "y": [ 3, 3, 1, 3, 1, 0, 0, 1, 0, 9, 0, 1, 1, 3, 0, 0, 1 ] } ], "layout": { "barmode": "group", "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 }, "autotypenumbers": "strict", "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": "Number of Positions Each Driver Began Behind 1st Place (2007 Season)" }, "xaxis": { "tickangle": -45, "title": { "text": "Race" } }, "yaxis": { "autorange": "reversed", "title": { "text": "Number of Positions" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "\n", "fig.add_trace(go.Bar(x=ham_2007_piv_pos.race, y=ham_2007_piv_pos.alon_grid_from1,\n", " name='Alonso', marker_color='#1C8356'))\n", "\n", "fig.add_trace(go.Bar(x=ham_2007_piv_pos.race, y=ham_2007_piv_pos.ham_grid_from1,\n", " name='Hamilton', marker_color='#2E91E5'))\n", "\n", "fig.update_layout(barmode='group', xaxis_tickangle=-45,\n", " yaxis=dict(title='Number of Positions'),\n", " xaxis=dict(title='Race'),\n", " title='Number of Positions Each Driver Began Behind 1st Place (2007 Season)')\n", "fig['layout']['yaxis']['autorange'] = \"reversed\"\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The graph above illustrates the starting position of Alonso and Hamilton for each race in the 2007 season; the shorter the bar, the closer each driver started towards first place. \n", "\n", "We also observe the following:\n", " - Alonso always began in the top 3, with the exception of the 2007 French Grand Prix and the 2007 Hungarian Grand Prix.\n", " - Hamilton always started in the top 3 before each race, besides the 2007 European Grand Prix.\n", "\n", "__Hamilton__ succeeded in strengthening his chance of finishing in a podium position more frequently than his McLaren counterpart." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# plot number of times Hamilton began ahead of alonso and vice-versa\n", "grid_comp = ham_2007[['race', 'dname', 'grid']].copy()\n", "grid_comp['grid_dif_ham'] = grid_comp.groupby('race')['grid'].diff()\n", "grid_comp['grid_dif_alon'] = grid_comp.groupby('race')['grid'].diff(-1)\n", "grid_comp['ham_ahead'] = (grid_comp.grid_dif_ham < 0).astype('int64')\n", "grid_comp['alon_ahead'] = (grid_comp.grid_dif_alon < 0).astype('int64')\n", "\n", "# aggregate number of times started ahead of teammate\n", "grid_comp = grid_comp.groupby(['dname'])[['ham_ahead', 'alon_ahead']].sum()\n", "grid_comp.reset_index(inplace=True)\n", "\n", "# consolidate into one column since only one of the two drivers are going to be ahead at a time\n", "grid_comp['ahead'] = grid_comp['ham_ahead'] + grid_comp['alon_ahead']\n", "grid_comp = grid_comp[['dname', 'ahead']]\n", "grid_comp['pct_ahead'] = grid_comp['ahead']/17" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hole": 0.3, "insidetextorientation": "radial", "labels": [ "Fernando Alonso", "Lewis Hamilton" ], "marker": { "colors": [ "#1C8356", "#2E91E5" ] }, "textinfo": "label+percent", "type": "pie", "values": [ 0.4117647058823529, 0.5882352941176471 ] } ], "layout": { "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 }, "autotypenumbers": "strict", "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": "Percentage of Races Where Driver Began Ahead of Teammate (2007 Season)" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure(data=[go.Pie(labels=grid_comp.dname, values=grid_comp.pct_ahead, textinfo='label+percent',\n", " insidetextorientation='radial', hole=.3)])\n", "\n", "colors=['#1C8356', '#2E91E5']\n", "fig.update_traces(marker=dict(colors=colors))\n", "fig.update_layout(title_text='Percentage of Races Where Driver Began Ahead of Teammate (2007 Season)')\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Hamilton started closer to first place in 10 of the 17 races in the 2007 season, making him the better driver in this first metric. Given the trend we saw before, we would expect Hamilton to have better finishing positions and subsequently gain more points.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5. Lap by Lap Positioning" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This next stage of the analysis looks at which position each driver tended to stay in each lap and position volatility. As we touched upon before, a better driver will produce consistent results and spend more time towards the front." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "box": { "visible": true }, "hovertemplate": "Driver=%{x}
Position=%{y}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "v", "points": "all", "scalegroup": "True", "showlegend": true, "type": "violin", "x": [ "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso" ], "x0": " ", "xaxis": "x", "y": [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 2, 2, 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, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 6, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 6, 5, 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 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, 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, 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 14, 13, 13, 12, 10, 9, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 9, 8, 7, 9, 9, 8, 8, 8, 7, 7, 6, 6, 6, 6, 6, 7, 7, 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 5, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 8, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 12, 12, 11, 9, 9, 9, 9, 9, 9, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 6, 6, 6, 6, 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 6, 6, 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 3, 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 8, 8, 8, 8, 7, 8, 10, 9, 8, 8, 8, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 6, 4, 4, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ], "y0": " ", "yaxis": "y" }, { "alignmentgroup": "True", "box": { "visible": true }, "hovertemplate": "Driver=%{x}
Position=%{y}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "v", "points": "all", "scalegroup": "True", "showlegend": true, "type": "violin", "x": [ "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton" ], "x0": " ", "xaxis": "x", "y": [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 4, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 1, 1, 4, 4, 3, 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, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 5, 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 5, 5, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 19, 11, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 8, 8, 8, 10, 10, 10, 10, 9, 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, 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, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 2, 3, 4, 4, 4, 4, 4, 4, 4, 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, 3, 3, 3, 3, 2, 4, 4, 6, 4, 4, 3, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 8, 7, 7, 7, 7, 7, 6, 18, 18, 18, 17, 16, 16, 16, 12, 12, 11, 11, 11, 11, 10, 10, 14, 14, 13, 13, 13, 13, 12, 12, 12, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7 ], "y0": " ", "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "Driver" }, "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 }, "autotypenumbers": "strict", "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": "Distribution of Positions in Each Lap Raced (2007 Season)" }, "violinmode": "overlay", "xaxis": { "anchor": "y", "categoryarray": [ "Fernando Alonso", "Lewis Hamilton" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Driver" } }, "yaxis": { "anchor": "x", "autorange": "reversed", "domain": [ 0, 1 ], "title": { "text": "Position" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = px.violin(ham_2007_lap, y='position', x='dname', box=True, points='all', color='dname',\n", " color_discrete_map={'Fernando Alonso': '#1C8356', 'Lewis Hamilton': '#2E91E5'},\n", " labels={'dname': 'Driver', 'position':'Position'},\n", " title='Distribution of Positions in Each Lap Raced (2007 Season)')\n", "fig['layout']['yaxis']['autorange'] = \"reversed\"\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The graph presents the following:\n", " - Hamilton spent more time closer towards the front than his teammate since the width of his plot exceeds that of Alonso's towards the front of the grid.\n", " - Hamilton's positioning was centered second place while Alonso's median positioning lingered in third place.\n", " - Alonso exhibited more consistency since Hamilton's violin plot extends farther down towards the back of the grid while Alonso's plot doesn't reach as extreme values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Focusing on consistency, we'll look at the standard deviation of each driver's positioning throughout each race. The smaller the standard deviation, the less their position varied. Since both Hamilton and Alonso (nearly) always began towards the front of the pack, they only had a few positions to gain while simultaneously having many positions to lose. Therefore, any improvement will marginally impact the standard deviation while any loss in position will likely have a large impact." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": [ "#2E91E5", "#1C8356", "#2E91E5", "#2E91E5", "red", "#2E91E5", "#1C8356", "#2E91E5", "#1C8356", "#1C8356", "#2E91E5", "#2E91E5", "#1C8356", "#1C8356", "#2E91E5", "#2E91E5", "#1C8356" ], "line": { "color": "Black", "width": 2 }, "size": 12, "symbol": "star-square" }, "mode": "markers", "text": [ "Hamilton More Consistent", "Alonso More Consistent", "Hamilton More Consistent", "Hamilton More Consistent", "Equally Consistent", "Hamilton More Consistent", "Alonso More Consistent", "Hamilton More Consistent", "Alonso More Consistent", "Alonso More Consistent", "Hamilton More Consistent", "Hamilton More Consistent", "Alonso More Consistent", "Alonso More Consistent", "Hamilton More Consistent", "Hamilton More Consistent", "Alonso More Consistent" ], "type": "scatter", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "y": [ -0.18013703465219555, 0.20334102128499187, -0.033962721029620724, -0.35765004018131336, 0, -2.705436183080675, 0.07920410681361673, -0.18535406106749164, 0.5429630650222397, 2.47833751916882, -1.876960672592696, -0.25077428569073, 0.3233780839561179, 0.14173968600596376, -1.8124755316866739, -0.11938260527692968, 2.4459806097802517 ] } ], "layout": { "shapes": [ { "line": { "color": "Black", "dash": "dot" }, "type": "line", "x0": -1, "x1": 17, "y0": 0, "y1": 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 }, "autotypenumbers": "strict", "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": "Comparison of Consistency Maintained Throughout Races (2007 Season)" }, "xaxis": { "title": { "text": "Race" } }, "yaxis": { "title": { "text": "Difference in Standard Deviation" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# look at difference in SD - smaller one means more consistent\n", "ham_lap_stddev = ham_2007_lap.groupby(['race_date', 'race', 'dname'])['position'].std()\n", "ham_lap_stddev = ham_lap_stddev.unstack()\n", "ham_lap_stddev.reset_index(inplace=True)\n", "ham_lap_stddev['dif'] = ham_lap_stddev['Lewis Hamilton'] - ham_lap_stddev['Fernando Alonso']\n", "\n", "# add column to indicate which driver better\n", "ham_lap_stddev['better'] = np.where(ham_lap_stddev.dif < 0 , 'Hamilton More Consistent', \n", " (np.where(ham_lap_stddev.dif > 0, 'Alonso More Consistent', 'Equally Consistent')))\n", "\n", "# function below sets the color based on whether marker is above/below y = 0 line\n", "def SetColor(x):\n", " if(x < 0):\n", " return \"#2E91E5\"\n", " elif(x > 0):\n", " return \"#1C8356\"\n", " else:\n", " return \"red\"\n", "\n", "\n", "fig = go.Figure(data=go.Scatter(x=ham_lap_stddev.race, y=ham_lap_stddev.dif, mode='markers',\n", " marker_symbol='star-square', text=ham_lap_stddev.better))\n", "fig.update_traces(marker=dict(size=12, color=list(map(SetColor, ham_lap_stddev.dif)),\n", " line=dict(width=2,\n", " color='Black')),\n", " selector=dict(mode='markers'))\n", "\n", "fig.update_layout(title='Comparison of Consistency Maintained Throughout Races (2007 Season)', xaxis=dict(title='Race'),\n", " yaxis=dict(title='Difference in Standard Deviation'))\n", "\n", "fig.add_shape(type='line', x0=-1, y0=0, x1=17, y1=0, line=dict(color='Black', dash='dot'),)\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Breaking this all down we see that:\n", " - Hamilton exhibited more consistency in 9 out of 17 races, signified by the blue markers below the dotted line.\n", " - Alonso had a smaller standard deviation in 7 out of 17 races, indicated by the green markers above the dotted line.\n", " - Both drivers had the same standard deviation in Monaco, shown by the one red marker.\n", "\n", "While this plot illustrates that Alonso's positioning fluctuated more than that of Hamilton's, the violin plot demonstrated him as the more dependable driver. *Yet more importantly*, Hamilton drove in the front of the pack in considerably more laps, which more heavily influences points and final positioning. As a result, __Hamilton outperformed Alonso__ again and so far is the more talented driver this season." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 6a. End of Race - Wins" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As we discussed earlier, wins is one of the easiest ways to decide which driver performs better in a season.\n", "\n", "Hamilton came in first in:\n", " - United States Grand Prix\n", " - Canadian Grand Prix\n", " - Hungarian Grand Prix\n", " - Japanese Grand Prix\n", "\n", "Alonso came in first in:\n", " - European Grand Prix\n", " - Italian Grand Prix\n", " - Monaco Grand Prix\n", " - Malaysian Grand Prix\n", " \n", "Surprisingly, both McLaren drivers ended up with the same number of wins at the end of the season." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We'll take a closer look at the positions Hamilton and Alonso finished in order to distinguish the two drivers." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "#1C8356" }, "name": "Alonso", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "y": [ 1, 0, 4, 2, 0, 6, 1, 6, 1, 0, 3, 2, 0, 2, 20, 1, 2 ] }, { "marker": { "color": "#2E91E5" }, "name": "Hamilton", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "y": [ 2, 1, 1, 1, 1, 0, 0, 2, 2, 8, 0, 4, 1, 3, 0, 18, 6 ] } ], "layout": { "barmode": "group", "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 }, "autotypenumbers": "strict", "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": "Number of Positions Each Driver Finished Behind 1st Place (2007 Season)" }, "xaxis": { "tickangle": -45, "title": { "text": "Race" } }, "yaxis": { "autorange": "reversed", "dtick": 2, "tick0": 0, "tickmode": "linear", "title": { "text": "Number of Positions" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# number of positions each driver finished behind first\n", "ham_2007_pos_piv = ham_2007_piv[['race', 'position']].copy()\n", "ham_2007_pos_piv['position'] = ham_2007_pos_piv['position'].astype('int64')\n", "ham_2007_pos_piv['ham_fin1'] = ham_2007_pos_piv['position']['Lewis Hamilton'] - 1\n", "ham_2007_pos_piv['alon_fin1'] = ham_2007_pos_piv['position']['Fernando Alonso'] - 1\n", "\n", "fig = go.Figure()\n", "\n", "fig.add_trace(go.Bar(x=ham_2007_pos_piv.race, y=ham_2007_pos_piv.alon_fin1,\n", " name='Alonso', marker_color='#1C8356'))\n", "\n", "fig.add_trace(go.Bar(x=ham_2007_pos_piv.race, y=ham_2007_pos_piv.ham_fin1,\n", " name='Hamilton', marker_color='#2E91E5'))\n", "\n", "fig.update_layout(barmode='group', xaxis_tickangle=-45,\n", " yaxis=dict(title='Number of Positions'),\n", " xaxis=dict(title='Race'),\n", " title='Number of Positions Each Driver Finished Behind 1st Place (2007 Season)')\n", "\n", "fig.update_layout(\n", " yaxis = dict(\n", " tickmode = 'linear',\n", " tick0 = 0,\n", " dtick = 2\n", " )\n", ")\n", "\n", "fig['layout']['yaxis']['autorange'] = \"reversed\"\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The chart above exhibits the following:\n", " - Hamilton finished on a podium position in 12 of the 17 races, observed by the blue bar having a height less than or equal to two.\n", " - Hamilton finished in 1st place 4 times, 2nd place 5 times, and 3rd place 3 times.\n", " - Alonso also had 12 races where he finished in the top 3.\n", " - Alonso finished in 1st 4 times, 2nd 4 times, and 3rd 4 times.\n", " \n", "While these two produce nearly identical statistics, __Hamilton slightly edges out Alonso__ by finishing in second place one more time than his teammate." ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "customdata": [ [ "2007 Australian Grand Prix", "Alonso" ], [ "2007 Malaysian Grand Prix", "Alonso" ], [ "2007 Bahrain Grand Prix", "Hamilton" ], [ "2007 Spanish Grand Prix", "Hamilton" ], [ "2007 Monaco Grand Prix", "Alonso" ], [ "2007 Canadian Grand Prix", "Hamilton" ], [ "2007 United States Grand Prix", "Hamilton" ], [ "2007 French Grand Prix", "Hamilton" ], [ "2007 British Grand Prix", "Alonso" ], [ "2007 European Grand Prix", "Alonso" ], [ "2007 Hungarian Grand Prix", "Hamilton" ], [ "2007 Turkish Grand Prix", "Alonso" ], [ "2007 Italian Grand Prix", "Alonso" ], [ "2007 Belgian Grand Prix", "Alonso" ], [ "2007 Japanese Grand Prix", "Hamilton" ], [ "2007 Chinese Grand Prix", "Alonso" ], [ "2007 Brazilian Grand Prix", "Alonso" ] ], "hovertemplate": "Race=%{customdata[0]}
Difference=%{marker.color}
Leading_Driver=%{customdata[1]}", "legendgroup": "", "marker": { "color": [ -1, -1, 3, 1, -1, 6, 1, 4, -1, -8, 3, -2, -1, -1, 20, -17, -4 ], "coloraxis": "coloraxis" }, "name": "", "offsetgroup": "", "orientation": "v", "showlegend": false, "textposition": "auto", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "xaxis": "x", "y": [ -1, -1, 3, 1, -1, 6, 1, 4, -1, -8, 3, -2, -1, -1, 20, -17, -4 ], "yaxis": "y" } ], "layout": { "barmode": "relative", "coloraxis": { "colorbar": { "title": { "text": "Difference" } }, "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" ] ] }, "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 }, "autotypenumbers": "strict", "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": "Number of Positions Hamilton Finished Ahead of Alonso (2007 Season)" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Race" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Difference" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# difference in positions\n", "ham_2007_pos_piv['end_dif'] = ham_2007_pos_piv['position']['Fernando Alonso'] - ham_2007_pos_piv['position']['Lewis Hamilton']\n", "\n", "# add column to indicate which driver finished ahead\n", "ham_2007_pos_piv['Leading_Driver'] = np.where(ham_2007_pos_piv.end_dif < 0 , 'Alonso', 'Hamilton')\n", "\n", "fig = px.bar(ham_2007_pos_piv, x='race', y='end_dif',\n", " labels={'race': 'Race', 'end_dif': 'Difference'},\n", " color='end_dif', hover_data=['race', 'Leading_Driver'],\n", " title='Number of Positions Hamilton Finished Ahead of Alonso (2007 Season)')\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hole": 0.3, "insidetextorientation": "radial", "labels": [ "Fernando Alonso", "Lewis Hamilton" ], "marker": { "colors": [ "#1C8356", "#2E91E5" ] }, "textinfo": "label+percent", "type": "pie", "values": [ 0.5882352941176471, 0.4117647058823529 ] } ], "layout": { "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 }, "autotypenumbers": "strict", "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": "Percentage of Races Where Driver Finished Ahead of Teammate (2007 Season)" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# plot number of times Hamilton finished ahead of alonso and vice-versa\n", "end_comp = ham_2007[['race', 'dname', 'position']].copy()\n", "end_comp['end_dif_ham'] = end_comp.groupby('race')['position'].diff()\n", "end_comp['end_dif_alon'] = end_comp.groupby('race')['position'].diff(-1)\n", "end_comp['ham_ahead'] = (end_comp.end_dif_ham < 0).astype('int64')\n", "end_comp['alon_ahead'] = (end_comp.end_dif_alon < 0).astype('int64')\n", "\n", "# aggregate number of times started ahead of teammate\n", "end_comp = end_comp.groupby(['dname'])[['ham_ahead', 'alon_ahead']].sum()\n", "end_comp.reset_index(inplace=True)\n", "\n", "# consolidate into one column since only one of the two drivers are going to be ahead at a time\n", "end_comp['ahead'] = end_comp['ham_ahead'] + end_comp['alon_ahead']\n", "end_comp = end_comp[['dname', 'ahead']]\n", "end_comp['pct_ahead'] = end_comp['ahead']/17\n", "\n", "fig = go.Figure(data=[go.Pie(labels=end_comp.dname, values=end_comp.pct_ahead, textinfo='label+percent',\n", " insidetextorientation='radial', hole=.3)])\n", "\n", "colors=['#1C8356', '#2E91E5']\n", "fig.update_traces(marker=dict(colors=colors))\n", "fig.update_layout(title_text='Percentage of Races Where Driver Finished Ahead of Teammate (2007 Season)')\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the two plots above, we notice that:\n", "- Hamilton finished ahead of Alonso in 7 of the 17 races as seen in the pie chart above.\n", " - Alonso typically only finished ahead of his teammate by a few positions - evident by the height of the bars below the x-axis in the graph above the pie chart.\n", " - Alonso only held a one position advantage in 60% of the races where he did finish better than his teammate.\n", " - Conversely, Hamilton tended to put more space between Alonso when he was the leading McLaren driver.\n", " \n", "Evidently, we have favorable findings for both drivers." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
Ending Position=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "notched": false, "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "type": "box", "x": [ 2, 1, 5, 3, 1, 7, 2, 7, 2, 1, 4, 3, 1, 3, 21, 2, 3 ], "x0": " ", "xaxis": "x", "y": [ "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso" ], "y0": " ", "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
Ending Position=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "notched": false, "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "type": "box", "x": [ 3, 2, 2, 2, 2, 1, 1, 3, 3, 9, 1, 5, 2, 4, 1, 19, 7 ], "x0": " ", "xaxis": "x", "y": [ "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton" ], "y0": " ", "yaxis": "y" } ], "layout": { "boxmode": "overlay", "legend": { "title": { "text": "Driver" }, "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 }, "autotypenumbers": "strict", "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": "Distribution of Finishing Position (2007 Season)" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Ending Position" } }, "yaxis": { "anchor": "x", "categoryarray": [ "Lewis Hamilton", "Fernando Alonso" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Driver" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# box plot for Alonso/Fernando of finishing positions - median seems to equal 75th percentile for hamilton\n", "ham_2007_pos = ham_2007[['race_date', 'race', 'dname', 'grid', 'position']].copy()\n", "ham_2007_pos['grid'] = ham_2007_pos['grid'].astype('int64')\n", "ham_2007_pos['position'] = ham_2007_pos['position'].astype('int64')\n", "\n", "fig = px.box(ham_2007_pos, y='dname', x='position', color='dname',\n", " color_discrete_map={'Fernando Alonso': '#1C8356', 'Lewis Hamilton': '#2E91E5'},\n", " labels={'dname': 'Driver', 'position': 'Ending Position'},\n", " title='Distribution of Finishing Position (2007 Season)')\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The box plots provide these conclusions:\n", " - Hamilton's median finishing position is 2nd place, better than Alonso's value of 3rd place.\n", " - Hamilton had more races where he finished closer to first place but had some where he finished unusually far behind, since his box plot is skewed right\n", " - Alonso's box plot is also slightly skewed right, though less so than Hamilton's. This means that the number of races where his ending position was towards the front was more evenly split with the number of races where he placed farther back.\n", "\n", "While Alonso achieved better placement than his teammate in more races, he usually finished ahead by only a single position. However, when it comes to podium placement, the most important component of final position, Hamilton holds the crown. Furthermore, Hamilton tended to finish in better positions when looking at descriptive statistics. While the comparison in this metric is much closer than the previous ones, __Hamilton portrays himself as the superior driver__ in terms of final positioning." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 6b. End of Race - Points Earned" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As mentioned earlier, a driver's points determine where they place in the overall standings at the end of a season. While positioning and points are directly linked, we can still explore the subtleties to draw further distinctions between Alonso and Hamilton. " ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Australian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356", "line": { "color": "black", "width": 1 } }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 8 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Australian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5", "line": { "color": "black", "width": 1 } }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 6 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "frames": [ { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Australian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 8 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Australian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 6 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Australian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Malaysian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 18 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Malaysian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 14 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Malaysian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Bahrain Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 22 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Bahrain Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 22 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Bahrain Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Spanish Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 28 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Spanish Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 30 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Spanish Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Monaco Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 38 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Monaco Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 38 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Monaco Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Canadian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 40 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Canadian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 48 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Canadian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 United States Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 48 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 United States Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 58 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 United States Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 French Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 50 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 French Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 64 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 French Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 British Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 58 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 British Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 70 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 British Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 European Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 68 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 European Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 70 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 European Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Hungarian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 73 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Hungarian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 80 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Hungarian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Turkish Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 79 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Turkish Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 84 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Turkish Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Italian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 89 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Italian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 92 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Italian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Belgian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 95 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Belgian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 97 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Belgian Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Japanese Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 95 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Japanese Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 107 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Japanese Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Chinese Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 103 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Chinese Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 107 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Chinese Grand Prix" }, { "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Brazilian Grand Prix
Points Earned=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 109 ], "xaxis": "x", "y": [ "Fernando Alonso" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
race=2007 Brazilian Grand Prix
Points Earned=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 109 ], "xaxis": "x", "y": [ "Lewis Hamilton" ], "yaxis": "y" } ], "name": "2007 Brazilian Grand Prix" } ], "layout": { "barmode": "relative", "legend": { "title": { "text": "Driver" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "sliders": [ { "active": 0, "currentvalue": { "prefix": "race=" }, "len": 0.9, "pad": { "b": 10, "t": 60 }, "steps": [ { "args": [ [ "2007 Australian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Australian Grand Prix", "method": "animate" }, { "args": [ [ "2007 Malaysian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Malaysian Grand Prix", "method": "animate" }, { "args": [ [ "2007 Bahrain Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Bahrain Grand Prix", "method": "animate" }, { "args": [ [ "2007 Spanish Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Spanish Grand Prix", "method": "animate" }, { "args": [ [ "2007 Monaco Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Monaco Grand Prix", "method": "animate" }, { "args": [ [ "2007 Canadian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Canadian Grand Prix", "method": "animate" }, { "args": [ [ "2007 United States Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 United States Grand Prix", "method": "animate" }, { "args": [ [ "2007 French Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 French Grand Prix", "method": "animate" }, { "args": [ [ "2007 British Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 British Grand Prix", "method": "animate" }, { "args": [ [ "2007 European Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 European Grand Prix", "method": "animate" }, { "args": [ [ "2007 Hungarian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Hungarian Grand Prix", "method": "animate" }, { "args": [ [ "2007 Turkish Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Turkish Grand Prix", "method": "animate" }, { "args": [ [ "2007 Italian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Italian Grand Prix", "method": "animate" }, { "args": [ [ "2007 Belgian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Belgian Grand Prix", "method": "animate" }, { "args": [ [ "2007 Japanese Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Japanese Grand Prix", "method": "animate" }, { "args": [ [ "2007 Chinese Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Chinese Grand Prix", "method": "animate" }, { "args": [ [ "2007 Brazilian Grand Prix" ], { "frame": { "duration": 0, "redraw": true }, "fromcurrent": true, "mode": "immediate", "transition": { "duration": 0, "easing": "linear" } } ], "label": "2007 Brazilian Grand Prix", "method": "animate" } ], "x": 0.1, "xanchor": "left", "y": 0, "yanchor": "top" } ], "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 }, "autotypenumbers": "strict", "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": "Points Earned By Each Driver (2007 Season)" }, "updatemenus": [ { "buttons": [ { "args": [ null, { "frame": { "duration": 800, "redraw": false }, "fromcurrent": true, "transition": { "duration": 800, "easing": "linear" } } ], "label": "Play", "method": "animate" }, { "args": [ [ null ], { "frame": { "duration": 0, "redraw": false }, "mode": "immediate", "transition": { "duration": 0 } } ], "label": "Pause", "method": "animate" } ], "direction": "left", "pad": { "r": 10, "t": 70 }, "showactive": false, "type": "buttons", "x": 0.1, "xanchor": "right", "y": 0, "yanchor": "top" } ], "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "range": [ 0, 120 ], "title": { "text": "Points Earned" } }, "yaxis": { "anchor": "x", "categoryarray": [ "Lewis Hamilton", "Fernando Alonso" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Driver" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# interactive graph - number of points\n", "ham_2007_finish = ham_2007[['race_date', 'race', 'dname', 'position', 'points']].copy()\n", "ham_2007_finish['win'] = (ham_2007_finish.position == 1).astype('int64')\n", "ham_2007_finish['sum_pts'] = ham_2007_finish.groupby(['dname'])['points'].cumsum()\n", "fig = px.bar(ham_2007_finish, x='sum_pts', y='dname', animation_frame='race', color='dname',\n", " labels={'dname': 'Driver', 'sum_pts': 'Points Earned'},\n", " color_discrete_map={'Fernando Alonso': '#1C8356', 'Lewis Hamilton': '#2E91E5'})\n", "\n", "fig.update_traces(dict(marker_line_width=1, marker_line_color=\"black\"))\n", "fig.update_layout(xaxis=dict(range=[0, 120]))\n", "fig.update_layout(title_text=\"Points Earned By Each Driver (2007 Season)\")\n", "\n", "# add buttons\n", "fig.update_layout(\n", " updatemenus = [\n", " {\n", " 'buttons': [\n", " {\n", " 'args': [None, {'frame': {'duration': 800, 'redraw': False},\n", " 'fromcurrent': True, 'transition': {'duration': 800,\n", " 'easing': 'linear'}}],\n", " 'label': 'Play',\n", " 'method': 'animate'\n", " },\n", " {\n", " 'args': [[None], {'frame': {'duration': 0, 'redraw': False},\n", " 'mode': 'immediate',\n", " 'transition': {'duration':0}}],\n", " 'label': 'Pause',\n", " 'method': 'animate'\n", " }\n", " ]\n", " \n", " }\n", " ]\n", ") \n", " \n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "At the end of the season, both drivers finished with 109 points. As a result, the two most decisive factors in determining the better driver fail to clearly distinguish which driver outperforms the other." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "customdata": [ [ "2007 Australian Grand Prix", "Alonso" ], [ "2007 Malaysian Grand Prix", "Alonso" ], [ "2007 Bahrain Grand Prix", "Hamilton" ], [ "2007 Spanish Grand Prix", "Hamilton" ], [ "2007 Monaco Grand Prix", "Alonso" ], [ "2007 Canadian Grand Prix", "Hamilton" ], [ "2007 United States Grand Prix", "Hamilton" ], [ "2007 French Grand Prix", "Hamilton" ], [ "2007 British Grand Prix", "Alonso" ], [ "2007 European Grand Prix", "Alonso" ], [ "2007 Hungarian Grand Prix", "Hamilton" ], [ "2007 Turkish Grand Prix", "Alonso" ], [ "2007 Italian Grand Prix", "Alonso" ], [ "2007 Belgian Grand Prix", "Alonso" ], [ "2007 Japanese Grand Prix", "Hamilton" ], [ "2007 Chinese Grand Prix", "Alonso" ], [ "2007 Brazilian Grand Prix", "Alonso" ] ], "hovertemplate": "Race=%{customdata[0]}
Difference=%{marker.color}
Leader=%{customdata[1]}", "legendgroup": "", "marker": { "color": [ -2, -2, 4, 2, -2, 8, 2, 4, -2, -10, 5, -2, -2, -1, 10, -8, -4 ], "coloraxis": "coloraxis" }, "name": "", "offsetgroup": "", "orientation": "v", "showlegend": false, "textposition": "auto", "type": "bar", "x": [ "2007 Australian Grand Prix", "2007 Malaysian Grand Prix", "2007 Bahrain Grand Prix", "2007 Spanish Grand Prix", "2007 Monaco Grand Prix", "2007 Canadian Grand Prix", "2007 United States Grand Prix", "2007 French Grand Prix", "2007 British Grand Prix", "2007 European Grand Prix", "2007 Hungarian Grand Prix", "2007 Turkish Grand Prix", "2007 Italian Grand Prix", "2007 Belgian Grand Prix", "2007 Japanese Grand Prix", "2007 Chinese Grand Prix", "2007 Brazilian Grand Prix" ], "xaxis": "x", "y": [ -2, -2, 4, 2, -2, 8, 2, 4, -2, -10, 5, -2, -2, -1, 10, -8, -4 ], "yaxis": "y" } ], "layout": { "barmode": "relative", "coloraxis": { "colorbar": { "title": { "text": "Difference" } }, "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" ] ] }, "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 }, "autotypenumbers": "strict", "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": "Difference in Points (2007 Season)" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Race" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Difference" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# explore difference in points per race\n", "ham_2007_pts_piv = ham_2007_piv[['race', 'points']].copy()\n", "ham_2007_pts_piv['points'] = ham_2007_pts_piv['points'].astype('float')\n", "ham_2007_pts_piv['dif'] = ham_2007_pts_piv['points']['Lewis Hamilton'] - ham_2007_pts_piv['points']['Fernando Alonso']\n", "\n", "ham_2007_pts_piv['Leader'] = np.where(ham_2007_pts_piv.dif < 0 , 'Alonso', 'Hamilton')\n", "\n", "fig = px.bar(ham_2007_pts_piv, x='race', y='dif',\n", " labels={'race': 'Race', 'dif': 'Difference'},\n", " color='dif', hover_data=['race', 'Leader'],\n", " title='Difference in Points (2007 Season)')\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Alonso scored more points in 10 races, which directly corresponds to the 10 races where he finished ahead of Hamilton. Once again, when Alonso scored more, it was only by a couple points. Meanwhile, Hamilton created a larger gap when he scored more points." ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
Points=%{x}", "legendgroup": "Fernando Alonso", "marker": { "color": "#1C8356" }, "name": "Fernando Alonso", "notched": false, "offsetgroup": "Fernando Alonso", "orientation": "h", "showlegend": true, "type": "box", "x": [ 8, 10, 4, 6, 10, 2, 8, 2, 8, 10, 5, 6, 10, 6, 0, 8, 6 ], "x0": " ", "xaxis": "x", "y": [ "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso", "Fernando Alonso" ], "y0": " ", "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Driver=%{y}
Points=%{x}", "legendgroup": "Lewis Hamilton", "marker": { "color": "#2E91E5" }, "name": "Lewis Hamilton", "notched": false, "offsetgroup": "Lewis Hamilton", "orientation": "h", "showlegend": true, "type": "box", "x": [ 6, 8, 8, 8, 8, 10, 10, 6, 6, 0, 10, 4, 8, 5, 10, 0, 2 ], "x0": " ", "xaxis": "x", "y": [ "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton", "Lewis Hamilton" ], "y0": " ", "yaxis": "y" } ], "layout": { "boxmode": "overlay", "legend": { "title": { "text": "Driver" }, "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 }, "autotypenumbers": "strict", "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": "Distribution of Points (2007 Season)" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Points" } }, "yaxis": { "anchor": "x", "categoryarray": [ "Lewis Hamilton", "Fernando Alonso" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Driver" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# box plot for Alonso/Fernando of points- median seems to equal 75th percentile for hamilton\n", "ham_2007_pts = ham_2007[['race', 'dname', 'points']].copy()\n", "fig = px.box(ham_2007_pts, y='dname', x='points', color='dname',\n", " color_discrete_map={'Fernando Alonso': '#1C8356', 'Lewis Hamilton': '#2E91E5'},\n", " labels={'dname': 'Driver', 'points': 'Points'}, title='Distribution of Points (2007 Season)')\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These distributions highlight that:\n", " - The two McLaren drivers scored the same number of points but Hamilton's median points were higher than Alonso's.\n", " - Hamilton frequently scored on the higher end of the points spectrum but had a few races where he scored a limited number of points, dragging his average points down. This is evident by the left skew of his box plot\n", " - Alonso's box plot tells the opposite story. While his skewness is less extreme than Hamilton's, it still indicates that Alonso repeatedly scored on the lower end of the points spectrum. Yet he still had a few races where he amassed a large number of points.\n", "\n", "In conclusion, we derive similar insights here as we did in the finishing position comparison since the two go hand in hand. __Hamilton barely beats Alonso__ in this criterion too." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7. Putting it All Together" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Putting all the metrics together, we can sum up what we found as the following:\n", "\n", "\n", "- Grid positioning: __Hamilton__ is the favorite in this category.\n", "\n", "\n", "- Driving positioning lap-to-lap: __Hamilton__ achieves favorable positioning on a given lap.\n", "\n", "- Finishing positions: Alonso finishes ahead of Hamilton more often. However, __Hamilton__ is superior where it counts most, podium placement. The difference in 2nd place finishes actually resulted in Hamilton finishing second and Alonso third in the drivers standing for the 2007 season.\n", "\n", "\n", "- Points: Alonso has more races with more points but __Hamilton__ has more favorable statistics.\n", "\n", "\n", "- Final Comparison:\n", " - Lewis Hamilton: ranks higher in __4__ of the metrics we looked at.\n", " - Fernando Alonso: ranks higher in __0__ of the metrics we looked at.\n", " \n", "__Overall:__ __Hamilton__ was the better driver in the 2007 season although they were very well-matched. This is is especially impressive since this was his rookie season while Alonso had a few years of experience under his belt. \n", "\n", "While Hamilton was victorious in each metric, it was a very evenly-matched comparison. Both drivers performed at a very high caliber and finished in the top 3 drivers standings for the 2007 season. Furthermore, as a team they completely dominated the charts as the only other team besides McLaren to win any races was Ferrari. It would be interesting to compare them again further down the line if they ever became teammates again. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 8. References" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. [2007 French Grand Prix](https://en.wikipedia.org/wiki/2007_French_Grand_Prix)\n", "2. [2007 Hungarian Grand Prix](https://en.wikipedia.org/wiki/2007_Hungarian_Grand_Prix)\n", "3. [2007 Chinese Grand Prix](https://en.wikipedia.org/wiki/2007_Chinese_Grand_Prix)\n", "4. [2007 Canadian Grand Prix](https://en.wikipedia.org/wiki/2007_Canadian_Grand_Prix)\n", "5. [2007 European Grand Prix](https://en.wikipedia.org/wiki/2007_European_Grand_Prix)\n", "6. [2007 Japanese Grand Prix](https://en.wikipedia.org/wiki/2007_Japanese_Grand_Prix)\n", "7. [2007 Brazilian Grand Prix](https://en.wikipedia.org/wiki/2007_Brazilian_Grand_Prix)\n", "8. [2007 Formula 1 World Championship](https://en.wikipedia.org/wiki/2007_Formula_One_World_Championship)" ] } ], "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.2" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": { "height": "calc(100% - 180px)", "left": "10px", "top": "150px", "width": "384px" }, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }