{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Do team colors influence sports success?\n", "\n", "I was recently listening to a podcast where the hosts were discussing Super Bowl LIV and what color each team would wear. Now, this discussion would typically be obvious but in this matchup, both the KC Chiefs and SF 49ers have colorways consisting of some shade of red, yellow, and white.\n", "\n", "Once it was determined who the home team was and that their home jersey was red, one of the hosts said something like: \"*That's their advantage. They get to wear red. Red is a dominant color*.\" They then had floated the idea of looking into the #'s of colors ans success, **so that's what we'll be looking into.**\n", "\n", "##### The Data\n", "To put this together, I scraped team primary + secondary colors (in hex) from [teamcolorcodes.com](https://teamcolorcodes.com/) for the MLB, NBA, NFL, NHL, Premier League (EPL), La Liga, Serie A, and the NCAA (Basketball + Football). These colors were by no means perfect for each team but they serve as a decent baseline.\n", "* Furthermore, I used the [webcolors](https://webcolors.readthedocs.io/en/1.10/) package to convert the hex colors into both CSS2 and CSS3 color names.\n", "* As well, I used the [wolframalpha](https://pypi.org/project/wolframalpha/) api to get english color names via the wolfram engine.\n", "\n", "Lastly, I scraped Wikipedia for some tables of leagues, teams & their number of championships.\n", "\n", "Let's get into it.\n", "\n", "### Importing packages, data, and creating some plotting helpers" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# importing packages\n", "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import matplotlib.ticker as ticker\n", "import seaborn as sns\n", "import glob\n", "import os\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "\n", "%matplotlib inline\n", "\n", "# set styles\n", "plt.rcParams[\"font.family\"] = \"monospace\"\n", "plt.rcParams[\"axes.facecolor\"] = \"#F0F0F0\"\n", "plt.rcParams[\"figure.facecolor\"] = \"#F0F0F0\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Team | \n", "hex_Primary_Color | \n", "hex_Secondary_Color | \n", "League | \n", "wc_css2_Primary_Name | \n", "wc_css2_Secondary_Name | \n", "wc_css3_Primary_Name | \n", "wc_css3_Secondary_Name | \n", "wa_Primary_Names | \n", "wa_Secondary_Names | \n", "wa_Primary_Name_1 | \n", "wa_Primary_Name_2 | \n", "wa_Secondary_Name_1 | \n", "wa_Secondary_Name_2 | \n", "Wins | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | \n", "Baltimore Ravens | \n", "#241773 | \n", "#000000 | \n", "NFL | \n", "Navy | \n", "Black | \n", "Midnightblue | \n", "Black | \n", "midnight blue,navy | \n", "black,dim gray | \n", "Midnight Blue | \n", "Navy | \n", "Black | \n", "Dim Gray | \n", "2 | \n", "
5 | \n", "Chicago Bears | \n", "#0B162A | \n", "#C83803 | \n", "NFL | \n", "Black | \n", "Red | \n", "Black | \n", "Firebrick | \n", "midnight blue,steel blue | \n", "orange red,chocolate | \n", "Midnight Blue | \n", "Steel Blue | \n", "Orange Red | \n", "Chocolate | \n", "1 | \n", "
8 | \n", "Dallas Cowboys | \n", "#041E42 | \n", "#869397 | \n", "NFL | \n", "Navy | \n", "Gray | \n", "Midnightblue | \n", "Lightslategray | \n", "navy,dark blue | \n", "light slate gray,slate gray | \n", "Navy | \n", "Dark Blue | \n", "Light Slate Gray | \n", "Slate Gray | \n", "5 | \n", "
9 | \n", "Denver Broncos | \n", "#002244 | \n", "#FB4F14 | \n", "NFL | \n", "Navy | \n", "Red | \n", "Midnightblue | \n", "Orangered | \n", "navy,teal | \n", "orange red,chocolate | \n", "Navy | \n", "Teal | \n", "Orange Red | \n", "Chocolate | \n", "3 | \n", "
11 | \n", "Green Bay Packers | \n", "#203731 | \n", "#FFB612 | \n", "NFL | \n", "Black | \n", "Orange | \n", "Darkslategray | \n", "Orange | \n", "dark slate gray,cadet blue | \n", "orange,dark orange | \n", "Dark Slate Gray | \n", "Cadet Blue | \n", "Orange | \n", "Dark Orange | \n", "4 | \n", "