{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "source": [
    "# read in data on draft picks and put it into a pandas dataframe\r\n",
    "import pandas as pd\r\n",
    "\r\n",
    "data = pd.read_table('2000-2021 Draft Picks.csv', sep=',')\r\n",
    "data.head(6000)"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "      Year  Round  Pick  Overall              Name        Team Position  \\\n",
       "0     2000      1     1        1    Courtney Brown      BROWNS       DE   \n",
       "1     2000      1     2        2   LaVar Arrington        TEAM       LB   \n",
       "2     2000      1     3        3     Chris Samuels        TEAM        T   \n",
       "3     2000      1     4        4     Peter Warrick     BENGALS       WR   \n",
       "4     2000      1     5        5       Jamal Lewis      RAVENS       RB   \n",
       "...    ...    ...   ...      ...               ...         ...      ...   \n",
       "5604  2021      7    28      255      Kawaan Baker      SAINTS       WR   \n",
       "5605  2021      7    29      256        Kylin Hill     PACKERS       RB   \n",
       "5606  2021      7    30      257  Jermar Jefferson       LIONS       RB   \n",
       "5607  2021      7    31      258         Dax Milne        TEAM       WR   \n",
       "5608  2021      7    32      259      Grant Stuard  BUCCANEERS       LB   \n",
       "\n",
       "                 School  \n",
       "0            Penn State  \n",
       "1            Penn State  \n",
       "2               Alabama  \n",
       "3         Florida State  \n",
       "4             Tennessee  \n",
       "...                 ...  \n",
       "5604      South Alabama  \n",
       "5605  Mississippi State  \n",
       "5606       Oregon State  \n",
       "5607      Brigham Young  \n",
       "5608            Houston  \n",
       "\n",
       "[5609 rows x 8 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Round</th>\n",
       "      <th>Pick</th>\n",
       "      <th>Overall</th>\n",
       "      <th>Name</th>\n",
       "      <th>Team</th>\n",
       "      <th>Position</th>\n",
       "      <th>School</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2000</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Courtney Brown</td>\n",
       "      <td>BROWNS</td>\n",
       "      <td>DE</td>\n",
       "      <td>Penn State</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2000</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>LaVar Arrington</td>\n",
       "      <td>TEAM</td>\n",
       "      <td>LB</td>\n",
       "      <td>Penn State</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2000</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Chris Samuels</td>\n",
       "      <td>TEAM</td>\n",
       "      <td>T</td>\n",
       "      <td>Alabama</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2000</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>Peter Warrick</td>\n",
       "      <td>BENGALS</td>\n",
       "      <td>WR</td>\n",
       "      <td>Florida State</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2000</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>Jamal Lewis</td>\n",
       "      <td>RAVENS</td>\n",
       "      <td>RB</td>\n",
       "      <td>Tennessee</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5604</th>\n",
       "      <td>2021</td>\n",
       "      <td>7</td>\n",
       "      <td>28</td>\n",
       "      <td>255</td>\n",
       "      <td>Kawaan Baker</td>\n",
       "      <td>SAINTS</td>\n",
       "      <td>WR</td>\n",
       "      <td>South Alabama</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5605</th>\n",
       "      <td>2021</td>\n",
       "      <td>7</td>\n",
       "      <td>29</td>\n",
       "      <td>256</td>\n",
       "      <td>Kylin Hill</td>\n",
       "      <td>PACKERS</td>\n",
       "      <td>RB</td>\n",
       "      <td>Mississippi State</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5606</th>\n",
       "      <td>2021</td>\n",
       "      <td>7</td>\n",
       "      <td>30</td>\n",
       "      <td>257</td>\n",
       "      <td>Jermar Jefferson</td>\n",
       "      <td>LIONS</td>\n",
       "      <td>RB</td>\n",
       "      <td>Oregon State</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5607</th>\n",
       "      <td>2021</td>\n",
       "      <td>7</td>\n",
       "      <td>31</td>\n",
       "      <td>258</td>\n",
       "      <td>Dax Milne</td>\n",
       "      <td>TEAM</td>\n",
       "      <td>WR</td>\n",
       "      <td>Brigham Young</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5608</th>\n",
       "      <td>2021</td>\n",
       "      <td>7</td>\n",
       "      <td>32</td>\n",
       "      <td>259</td>\n",
       "      <td>Grant Stuard</td>\n",
       "      <td>BUCCANEERS</td>\n",
       "      <td>LB</td>\n",
       "      <td>Houston</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5609 rows × 8 columns</p>\n",
       "</div>"
      ]
     },
     "metadata": {},
     "execution_count": 4
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [
    "# Tells us the rows and columns of our dataset\r\n",
    "data.shape"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "source": [
    "# This code gives us a count of each position in the dataframe\r\n",
    "data['Position'].value_counts()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "DB    1118\n",
       "WR     717\n",
       "LB     692\n",
       "DE     510\n",
       "RB     503\n",
       "DT     459\n",
       " T     454\n",
       "TE     322\n",
       " G     307\n",
       "QB     271\n",
       " C     167\n",
       " K      47\n",
       " P      42\n",
       "Name: Position, dtype: int64"
      ]
     },
     "metadata": {},
     "execution_count": 5
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "source": [
    "# We want to make some of our columns categorical, so they're more easily manipulated. Even though Year and Round are technically integers, \r\n",
    "# we want them cast to categories so we can make predictions about the future.  If they remain as integers the computer may think that a \r\n",
    "# draft is possible in the year 2025.4567 or that a player could be taken in round 6.772.  Making them categories lets the computer know that \r\n",
    "# there are no values \"in between\" these numbers. We will leave Pick and Overall as integers because it will make it easier to average and predict \r\n",
    "# because these integers are more ordinal than some of the others. Round could probably go either way since it also has an ordinal nature to it, but \r\n",
    "# I think it makes a better category since there are only 7.\r\n",
    "\r\n",
    "data['Position'] = data.Position.astype('category')\r\n",
    "data['Round'] = data.Round.astype('category')\r\n",
    "data['Team'] = data.Team.astype('category')\r\n",
    "data['School'] = data.School.astype('category')\r\n",
    "data['Year'] = data.Year.astype('category')\r\n",
    "\r\n",
    "print (data.dtypes)"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Year        category\n",
      "Round       category\n",
      "Pick           int64\n",
      "Overall        int64\n",
      "Name          object\n",
      "Team        category\n",
      "Position    category\n",
      "School      category\n",
      "dtype: object\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "source": [
    "# Let's check the value counts for the Team column. \r\n",
    "print(data['Team'].value_counts())"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "49ERS          197\n",
      "PACKERS        197\n",
      "VIKINGS        193\n",
      "BENGALS        192\n",
      "RAMS           192\n",
      "SEAHAWKS       191\n",
      "PATRIOTS       191\n",
      "RAVENS         187\n",
      "BROWNS         185\n",
      "TITANS         184\n",
      "JAGUARS        179\n",
      "EAGLES         179\n",
      "BRONCOS        178\n",
      "COLTS          178\n",
      "BILLS          175\n",
      "STEELERS       175\n",
      "RAIDERS        175\n",
      "COWBOYS        173\n",
      "LIONS          170\n",
      "TEAM           167\n",
      "DOLPHINS       166\n",
      "CHIEFS         166\n",
      "BUCCANEERS     166\n",
      "PANTHERS       165\n",
      "CARDINALS      162\n",
      "FALCONS        161\n",
      "BEARS          161\n",
      "CHARGERS       159\n",
      "GIANTS         158\n",
      "JETS           157\n",
      "TEXANS         154\n",
      "SAINTS         139\n",
      "COWBOYS          5\n",
      "PATRIOTS         3\n",
      "DOLPHINS         3\n",
      "BEARS            2\n",
      "TITANS           2\n",
      "GIANTS           2\n",
      "FALCONS          2\n",
      "EAGLES           2\n",
      "SAINTS           2\n",
      "BUCCANEERS       1\n",
      "BILLS            1\n",
      "TEXANS           1\n",
      "BRONCOS          1\n",
      "STEELERS         1\n",
      "REDSKINS         1\n",
      "SEAHAWKS         1\n",
      "PACKERS          1\n",
      "RAVENS           1\n",
      "RAMS             1\n",
      "RAIDERS          1\n",
      "PANTHERS         1\n",
      "BENGALS          1\n",
      "LIONS            1\n",
      "Name: Team, dtype: int64\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "source": [
    "# For the most part we are seeing what we wanted to see, but it needs some attention because there are repeat teams with different spellings and/or capitalization \r\n",
    "# and some with different spellings that as still repeated. It also has 8 rows that just say \"team\" so we need to look into those.\r\n",
    "# Let's try to capitalize the column to see if that helps\r\n",
    "data['Team'] = data['Team'].str.upper()\r\n",
    "data['Team'].value_counts()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "49ERS          197\n",
       "PACKERS        197\n",
       "VIKINGS        193\n",
       "BENGALS        192\n",
       "RAMS           192\n",
       "SEAHAWKS       191\n",
       "PATRIOTS       191\n",
       "RAVENS         187\n",
       "BROWNS         185\n",
       "TITANS         184\n",
       "JAGUARS        179\n",
       "EAGLES         179\n",
       "COLTS          178\n",
       "BRONCOS        178\n",
       "STEELERS       175\n",
       "BILLS          175\n",
       "RAIDERS        175\n",
       "COWBOYS        173\n",
       "LIONS          170\n",
       "TEAM           167\n",
       "BUCCANEERS     166\n",
       "CHIEFS         166\n",
       "DOLPHINS       166\n",
       "PANTHERS       165\n",
       "CARDINALS      162\n",
       "BEARS          161\n",
       "FALCONS        161\n",
       "CHARGERS       159\n",
       "GIANTS         158\n",
       "JETS           157\n",
       "TEXANS         154\n",
       "SAINTS         139\n",
       "COWBOYS          5\n",
       "DOLPHINS         3\n",
       "PATRIOTS         3\n",
       "TITANS           2\n",
       "FALCONS          2\n",
       "BEARS            2\n",
       "GIANTS           2\n",
       "EAGLES           2\n",
       "SAINTS           2\n",
       "BENGALS          1\n",
       "PACKERS          1\n",
       "STEELERS         1\n",
       "PANTHERS         1\n",
       "BRONCOS          1\n",
       "REDSKINS         1\n",
       "BUCCANEERS       1\n",
       "SEAHAWKS         1\n",
       "RAMS             1\n",
       "RAIDERS          1\n",
       "LIONS            1\n",
       "BILLS            1\n",
       "RAVENS           1\n",
       "TEXANS           1\n",
       "Name: Team, dtype: int64"
      ]
     },
     "metadata": {},
     "execution_count": 9
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "source": [
    "# Better but not perfect yet.  Now let's check for duplicates. There are 32 teams in the NFL, so we should get the answer 33 because of the \"TEAM\" value.\r\n",
    "s = data['Team'].nunique()\r\n",
    "print(s)   "
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "55\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "source": [
    "#That didn't work. Maybe there are cells with trailing blank spaces.  Let's eliminate those with the .strip() function then look for the unique cells again.\r\n",
    "\r\n",
    "data['Team'] = data['Team'].str.strip()\r\n",
    "data['Team'].value_counts()\r\n",
    "s = data['Team'].nunique()\r\n",
    "print(s)   "
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "32\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "source": [
    "# Just what we wanted. Now let's update team names.  The Washington Football Team used to have another name, so we need to change the old nickname to the new one.\r\n",
    "data[\"Team\"].replace({\"REDSKINS\": \"TEAM\"}, inplace=True)"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "source": [
    "#Let's make sure there isn't any occurences of the old nickname left\r\n",
    "data['Team'].value_counts()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "PACKERS       198\n",
       "49ERS         197\n",
       "PATRIOTS      194\n",
       "BENGALS       193\n",
       "VIKINGS       193\n",
       "RAMS          193\n",
       "SEAHAWKS      192\n",
       "RAVENS        188\n",
       "TITANS        186\n",
       "BROWNS        185\n",
       "EAGLES        181\n",
       "BRONCOS       179\n",
       "JAGUARS       179\n",
       "COWBOYS       178\n",
       "COLTS         178\n",
       "RAIDERS       176\n",
       "STEELERS      176\n",
       "BILLS         176\n",
       "LIONS         171\n",
       "DOLPHINS      169\n",
       "TEAM          168\n",
       "BUCCANEERS    167\n",
       "CHIEFS        166\n",
       "PANTHERS      166\n",
       "BEARS         163\n",
       "FALCONS       163\n",
       "CARDINALS     162\n",
       "GIANTS        160\n",
       "CHARGERS      159\n",
       "JETS          157\n",
       "TEXANS        155\n",
       "SAINTS        141\n",
       "Name: Team, dtype: int64"
      ]
     },
     "metadata": {},
     "execution_count": 14
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "# Data Analysis"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "Let's start to look at our data now that we've cleaned it. Let's start by looking at which are the top schools in the draft.  "
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Top 5 schools by position"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "source": [
    "from itertools import islice\r\n",
    "import matplotlib.pyplot as plt; plt.rcdefaults()\r\n",
    "import numpy as np\r\n",
    "import matplotlib.pyplot as plt\r\n",
    "import seaborn as sns\r\n",
    "\r\n",
    "def take(n, iterable):\r\n",
    "    # Return first n items of the iterable as a list\r\n",
    "    return list(islice(iterable, n))\r\n",
    "\r\n",
    "#Creating an index for our color palette to iterate through later on. There are better ways to do this using enumerate\r\n",
    "cp = 0\r\n",
    "\r\n",
    "# variable of all schools in data set for code to loop through\r\n",
    "school = data['School'].value_counts().index\r\n",
    "\r\n",
    "# variable of all positions in data set\r\n",
    "position = data['Position'].value_counts().index\r\n",
    "\r\n",
    "# creating a dictionary to store key value pairs of School and Number of Draft picks by Position\r\n",
    "dicts = {}\r\n",
    "\r\n",
    "# creating list of positions\r\n",
    "pos=[]\r\n",
    "posDF=[]\r\n",
    "for p in position:\r\n",
    "    pos.append(p)\r\n",
    "\r\n",
    "# for every position\r\n",
    "for j in position:\r\n",
    "    for p in range (5): #range is 5 because we are looking for top 5 schools\r\n",
    "        posDF.append(str(j))\r\n",
    "    for i in school:\r\n",
    "        x = data.loc[(data['Position']==str(j)) & (data['School']==str(i))] #create a combination to count (i.e. 'QB' & 'Alabama')\r\n",
    "        z=x.count()[0] # Count how many times the above combination ^ (x) is in the data set \r\n",
    "        dicts.update( {str(i) : z} ) # add school and total to dictionary\r\n",
    "\r\n",
    "    #order the list by value small to large and take the last 5 (the largest 5)\r\n",
    "    b = {k: v for k, v in sorted(dicts.items(), key=lambda item: item[1])}\r\n",
    "    uni = list(islice(reversed(b), 0, 5))\r\n",
    "\r\n",
    "    # Create list for number of picks from list above (uni).  \r\n",
    "    # This was easier for me than trying to keep track of the largest 5 during the loop above\r\n",
    "    top5=[]\r\n",
    "    for i in uni:\r\n",
    "        x=dicts[i]\r\n",
    "        top5.append(x)\r\n",
    "\r\n",
    "    \r\n",
    "    # Create Graphs\r\n",
    "    # This first chucnk of code will allow us to use the seaborn package to style our plots.  Palette is used to store a series of different \r\n",
    "    # color gradients.  A quick google search for seaborn color palettes will give you all the names and show you visuals of them\r\n",
    "    plt.style.use(\"seaborn\")\r\n",
    "    palette = [\r\n",
    "            sns.color_palette(\"winter\", 7),\r\n",
    "            sns.color_palette(\"viridis_r\", 7),\r\n",
    "            sns.color_palette(\"inferno\", 7),\r\n",
    "            sns.color_palette(\"cividis\", 7),\r\n",
    "            sns.color_palette(\"autumn_r\", 7),\r\n",
    "            sns.color_palette(\"twilight\", 7),\r\n",
    "            sns.color_palette(\"gnuplot\", 7),\r\n",
    "            sns.color_palette(\"gist_stern\", 7),\r\n",
    "            sns.color_palette(\"Spectral_r\", 7),\r\n",
    "            sns.color_palette(\"CMRmap_r\", 7),\r\n",
    "            sns.color_palette(\"Dark2\", 7),\r\n",
    "            sns.color_palette(\"GnBu\", 7),\r\n",
    "            sns.color_palette(\"PRGn\", 7),\r\n",
    "            sns.color_palette(\"Dark2_r\", 7),\r\n",
    "            sns.color_palette(\"afmhot\", 7),\r\n",
    "            sns.color_palette(\"autumn\", 7),\r\n",
    "            sns.color_palette(\"bone\", 7),\r\n",
    "            sns.color_palette(\"brg_r\", 7),\r\n",
    "            ]\r\n",
    "    # This picks the size of the chart in the output cell\r\n",
    "    fig = plt.figure(figsize=(8,6))\r\n",
    "    # Adding a subplot grid for your reference in case you want to use it.  I'm not really using it here because we want the charts to be readable, \r\n",
    "    # but normally you would use this to display a series of charts in grid form. It will also allow you to share an axis with other charts.\r\n",
    "    axes = fig.add_subplot(1,1,1)\r\n",
    "    # setting y limit to 40\r\n",
    "    axes.set_ylim(0, 40)\r\n",
    "\r\n",
    "    # arranging values\r\n",
    "    y_pos = np.arange(len(uni))\r\n",
    "    #creating chart, adding x and y values, alpha is the color \"strength\"\r\n",
    "    plt.bar(y_pos, top5, align='center', alpha=1, color=palette[cp])\r\n",
    "\r\n",
    "    # setting more chart options\r\n",
    "    plt.xticks(y_pos, uni)\r\n",
    "    plt.ylabel('Total Number of Draft Picks Since 2000')\r\n",
    "    plt.title('Top 5 Schools for %s' % posDF[0])\r\n",
    "\r\n",
    "    #displaying chart, resetting position list and iterating on color palette\r\n",
    "    plt.show()\r\n",
    "    posDF=[]\r\n",
    "    cp += 1\r\n"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31416 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31320 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30120 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30892 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31380 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30428 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30520 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29916 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30564 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30296 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30872 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30220 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 32236 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "This bit of code produces graphs that aren't in the blog. These charts were eventually replaced with a heatmap table from Tableau but contain the same information,\r\n",
    "it's just displayed differently."
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Top 5 schools by round"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "source": [
    "from itertools import islice\r\n",
    "import matplotlib.pyplot as plt; plt.rcdefaults()\r\n",
    "import numpy as np\r\n",
    "import matplotlib.pyplot as plt\r\n",
    "import random\r\n",
    "\r\n",
    "def take(n, iterable):\r\n",
    "    # Return first n items of the iterable as a list\r\n",
    "    return list(islice(iterable, n))\r\n",
    "\r\n",
    "# variable of all schools in data set for code to loop through\r\n",
    "school = data['School'].value_counts().index\r\n",
    "\r\n",
    "# variable of all rounds in data set\r\n",
    "rounds = data['Round'].value_counts().index\r\n",
    "\r\n",
    "# creating a dictionary to store key value pairs of School and Number of Draft picks by Round\r\n",
    "dicts = {}\r\n",
    "\r\n",
    "# creating list of rounds (7)\r\n",
    "round=[]\r\n",
    "roundDF=[]\r\n",
    "for r in round:\r\n",
    "    round.append(r)\r\n",
    "\r\n",
    "# for every round\r\n",
    "for j in rounds:\r\n",
    "    for _ in range (5):\r\n",
    "        roundDF.append(str(j))\r\n",
    "    for i in school:\r\n",
    "        x = data.loc[(data['Round']==j) & (data['School']==str(i))] #create a combination to count (i.e. '1' & 'Alabama')\r\n",
    "        z=x.count()[0] # Count how many times the above combination ^ (x) is in the data set \r\n",
    "        dicts.update( {str(i) : z} ) # add school and total to dictionary\r\n",
    "\r\n",
    "    #order the list by value small to large and take the last 5 (the largest 5)\r\n",
    "    b = {k: v for k, v in sorted(dicts.items(), key=lambda item: item[1])}\r\n",
    "    rou = list(islice(reversed(b), 0, 5))\r\n",
    "\r\n",
    "    #Create list for number of picks from list above (uni).  \r\n",
    "    # This was easier for me than trying to keep track of the largest 5 during the loop above\r\n",
    "    top5=[]\r\n",
    "    for i in rou:\r\n",
    "        x=dicts[i]\r\n",
    "        top5.append(x)\r\n",
    "    \r\n",
    "\r\n",
    "    # Creating a massive color palette for some of our other charts\r\n",
    "    # everything else in this code is commented above\r\n",
    "    colors = ['Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', \r\n",
    "    'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', \r\n",
    "    'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', \r\n",
    "    'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', \r\n",
    "    'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', \r\n",
    "    'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', \r\n",
    "    'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', \r\n",
    "    'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', \r\n",
    "    'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', \r\n",
    "    'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r',\r\n",
    "    'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r',\r\n",
    "    'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', \r\n",
    "    'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r',\r\n",
    "    'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', \r\n",
    "    'inferno_r', 'magma', 'magma_r', 'mako', 'mako_r', \r\n",
    "    'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r',\r\n",
    "    'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r',\r\n",
    "    'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spring', 'spring_r',\r\n",
    "    'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b',\r\n",
    "    'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'twilight',\r\n",
    "    'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r']\r\n",
    "    x=random.randint(0,169)\r\n",
    "    plt.style.use(\"seaborn\")\r\n",
    "    palettes =sns.color_palette(colors[x], 7),\r\n",
    "    fig = plt.figure(figsize=(8,6))\r\n",
    "    axes = fig.add_subplot(1,1,1)\r\n",
    "\r\n",
    "    # Create Graphs\r\n",
    "    y_pos = np.arange(len(rou))\r\n",
    "    sns.barplot(y_pos, top5, alpha=1, palette=colors[x])\r\n",
    "\r\n",
    "    plt.xticks(y_pos, rou)\r\n",
    "    plt.ylabel('Total Number of Draft Picks Since 2000')\r\n",
    "    plt.title('Top 5 Schools for Round %s' % roundDF[0])\r\n",
    "    \r\n",
    "    plt.show()\r\n",
    "    roundDF=[]"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29448 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 28168 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27152 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 32260 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29288 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31640 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29032 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## This code give us the top positions taken by round since 2000.  It's very similar to the other code above, we're jsut exchanging features at this point\r\n"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "source": [
    "from itertools import islice\r\n",
    "import matplotlib.pyplot as plt; plt.rcdefaults()\r\n",
    "import numpy as np\r\n",
    "import matplotlib.pyplot as plt\r\n",
    "import seaborn as sns\r\n",
    "\r\n",
    "def take(n, iterable):\r\n",
    "    # Return first n items of the iterable as a list\r\n",
    "    return list(islice(iterable, n))\r\n",
    "\r\n",
    "cp = 0\r\n",
    "# variable of all positions in data set for code to loop through\r\n",
    "position = data['Position'].value_counts().index\r\n",
    "\r\n",
    "# variable of all rounds in data set\r\n",
    "rounds = data['Round'].value_counts().index\r\n",
    "\r\n",
    "# creating a dictionary to store key value pairs of position and Number of Draft picks by Round\r\n",
    "dicts = {}\r\n",
    "\r\n",
    "# creating list of rounds (7)\r\n",
    "round=[]\r\n",
    "roundDF=[]\r\n",
    "for r in round:\r\n",
    "    round.append(r)\r\n",
    "\r\n",
    "# for every round\r\n",
    "for j in rounds:\r\n",
    "    #print(str(j))\r\n",
    "    for r in range (5):\r\n",
    "        roundDF.append(str(j))\r\n",
    "    for i in position:\r\n",
    "        x = data.loc[(data['Round']==j) & (data['Position']==str(i))] #create a combination to count (i.e. '1' & 'Alabama')\r\n",
    "        z=x.count()[0] # Count how many times the above combination ^ (x) is in the data set \r\n",
    "        dicts.update( {str(i) : z} ) # add position and total to dictionary\r\n",
    "\r\n",
    "    #order the list by value small to large and take the last 5 (the largest 5)\r\n",
    "    b = {k: v for k, v in sorted(dicts.items(), key=lambda item: item[1])}\r\n",
    "    rou = list(islice(reversed(b), 0, 5))\r\n",
    "\r\n",
    "    #Create list for number of picks from list above (uni).  \r\n",
    "    # This was easier for me than trying to keep track of the largest 5 during the loop above\r\n",
    "    top5=[]\r\n",
    "    for i in rou:\r\n",
    "        x=dicts[i]\r\n",
    "        top5.append(x)\r\n",
    "    \r\n",
    "    # Create Graphs\r\n",
    "\r\n",
    "    plt.style.use(\"seaborn\")\r\n",
    "    palette = [\r\n",
    "            sns.color_palette(\"winter\", 7),\r\n",
    "            sns.color_palette(\"viridis_r\", 7),\r\n",
    "            sns.color_palette(\"inferno\", 7),\r\n",
    "            sns.color_palette(\"cividis\", 7),\r\n",
    "            sns.color_palette(\"autumn_r\", 7),\r\n",
    "            sns.color_palette(\"twilight\", 7),\r\n",
    "            sns.color_palette(\"gnuplot\", 7),\r\n",
    "            sns.color_palette(\"gist_stern\", 7),\r\n",
    "            sns.color_palette(\"Spectral_r\", 7)\r\n",
    "            ]\r\n",
    "    fig = plt.figure(figsize=(8,6))\r\n",
    "    axes = fig.add_subplot(1,1,1)\r\n",
    "    axes.set_ylim(0, 200)\r\n",
    "    y_pos = np.arange(len(rou))\r\n",
    "    plt.bar(y_pos, top5, align='center', alpha=1, color=palette[cp])\r\n",
    "    \r\n",
    "    plt.xticks(y_pos, rou)\r\n",
    "    plt.ylabel('Total Number of Draft Picks Since 2000')\r\n",
    "    plt.title('Position taken for Round %s' % roundDF[0])\r\n",
    "    \r\n",
    "    roundDF=[]\r\n",
    "    cp+=1\r\n",
    "plt.show()"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27568 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27568 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27464 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27308 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27564 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 26984 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27340 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## This code totals which positions were taken by each team since 2000 - again most of the code is similar to those above."
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "source": [
    "from itertools import islice\r\n",
    "import matplotlib.pyplot as plt; plt.rcdefaults()\r\n",
    "import numpy as np\r\n",
    "import matplotlib.pyplot as plt\r\n",
    "import random \r\n",
    "import seaborn as sns\r\n",
    "\r\n",
    "def take(n, iterable):\r\n",
    "    # Return first n items of the iterable as a list\r\n",
    "    return list(islice(iterable, n))\r\n",
    "\r\n",
    "# variable of all positions in data set for code to loop through\r\n",
    "position = data['Position'].value_counts().index\r\n",
    "\r\n",
    "# variable of all rounds in data set\r\n",
    "teams = data['Team'].value_counts().index\r\n",
    "\r\n",
    "# creating a dictionary to store key value pairs of position and Number of Draft picks by Round\r\n",
    "dicts = {}\r\n",
    "\r\n",
    "# creating list of rounds (7)\r\n",
    "team=[]\r\n",
    "teamDF=[]\r\n",
    "for r in teams:\r\n",
    "    team.append(r)\r\n",
    "\r\n",
    "# for every round\r\n",
    "for j in teams:\r\n",
    "    #print(str(j))\r\n",
    "    for t in range (5):\r\n",
    "        teamDF.append(str(j))\r\n",
    "    for i in position:\r\n",
    "        x = data.loc[(data['Team']==str(j)) & (data['Position']==str(i))] #create a combination to count (i.e. '1' & 'Alabama')\r\n",
    "        z=x.count()[0] # Count how many times the above combination ^ (x) is in the data set \r\n",
    "        dicts.update( {str(i) : z} ) # add position and total to dictionary\r\n",
    "\r\n",
    "    #order the list by value small to large and take the last 5 (the largest 5)\r\n",
    "    b = {k: v for k, v in sorted(dicts.items(), key=lambda item: item[1])}\r\n",
    "    tea = list(islice(reversed(b), 0, 13))\r\n",
    "\r\n",
    "    #Create list for number of picks from list above (uni).  \r\n",
    "    # This was easier for me than trying to keep track of the largest 5 during the loop above\r\n",
    "    top13=[]\r\n",
    "    for i in tea:\r\n",
    "        x=dicts[i]\r\n",
    "        top13.append(x)\r\n",
    "    \r\n",
    "    colors = ['Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', \r\n",
    "    'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', \r\n",
    "    'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', \r\n",
    "    'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', \r\n",
    "    'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', \r\n",
    "    'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', \r\n",
    "    'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', \r\n",
    "    'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', \r\n",
    "    'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', \r\n",
    "    'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r',\r\n",
    "    'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r',\r\n",
    "    'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', \r\n",
    "    'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r',\r\n",
    "    'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', \r\n",
    "    'inferno_r', 'magma', 'magma_r', 'mako', 'mako_r', \r\n",
    "    'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r',\r\n",
    "    'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r',\r\n",
    "    'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spring', 'spring_r',\r\n",
    "    'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b',\r\n",
    "    'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'twilight',\r\n",
    "    'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r']\r\n",
    "    x=random.randint(0,169)\r\n",
    "    plt.style.use(\"seaborn\")\r\n",
    "    palettes =sns.color_palette(colors[x], 7),\r\n",
    "    fig = plt.figure(figsize=(8,6))\r\n",
    "    axes = fig.add_subplot(1,1,1)\r\n",
    "\r\n",
    "    # Create Graphs\r\n",
    "    y_pos = np.arange(len(tea))\r\n",
    "    sns.barplot(y_pos, top13, alpha=1, palette=colors[x])\r\n",
    "    plt.xticks(y_pos, tea)\r\n",
    "    plt.ylabel('Total Number of Draft Picks Since 2000')\r\n",
    "    plt.title('Total Draft Picks by Position for the %s' % teamDF[0])\r\n",
    "    plt.savefig(str(teamDF[0]) + \".png\")\r\n",
    "    plt.show()\r\n",
    "    teamDF=[]\r\n",
    "    \r\n",
    "    "
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30848 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31480 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31564 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30388 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30988 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31352 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31252 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30368 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31564 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 32424 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30816 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 32260 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31400 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30092 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31396 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31944 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30264 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30264 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29928 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30556 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30392 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 31736 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29764 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30884 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30992 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 32120 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30128 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30764 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30928 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30092 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 30436 characters]"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "C:\\Python39\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ],
      "image/png": "[encoded data, 29380 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## This code block is really simple and gives us a single graph totalling all picks for each team."
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "source": [
    "import seaborn as sns\r\n",
    "\r\n",
    "# Picking style of graph\r\n",
    "sns.set_style(\"white\", {\"xtick.major.size\": 0, \"ytick.major.size\": 0})\r\n",
    "\r\n",
    "# Creating a countplot (density)\r\n",
    "sns.countplot(y=\"Team\", data=data, order=data['Team'].value_counts().index, palette='cividis', orient='h' ).set_title('NFL Players Drafted Since 2000 by Team')\r\n",
    "\r\n",
    "# Removing some of the borders to make it a little easier to read\r\n",
    "sns.despine(left=True, bottom=True)"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x550 with 1 Axes>"
      ],
      "image/png": "[encoded data, 74708 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## This code block is similar to the one above it, except that it totals the position feature."
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "source": [
    "import seaborn as sns\r\n",
    "sns.set_style(\"darkgrid\", {\"xtick.major.size\": 0, \"ytick.major.size\": 0})\r\n",
    "ax = sns.countplot(y=\"Position\", data=data, order=data['Position'].value_counts().index[:25], palette='Set1', orient='v' ).set_title('Total Number of Draft Picks by Position Since 2000')\r\n",
    "sns.despine(left=True, bottom=True)"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x550 with 1 Axes>"
      ],
      "image/png": "[encoded data, 27312 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Another similar chart but totalling picks by round"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "source": [
    "import seaborn as sns\r\n",
    "sns.set_style(\"white\", {\"xtick.major.size\": 0, \"ytick.major.size\": 0})\r\n",
    "sns.countplot(y=\"Round\", data=data, order=data['Round'].value_counts().index, palette='gist_earth', orient='h' ).set_title('Total Number of Draft Picks per Since 2000')\r\n",
    "sns.despine(left=True, bottom=True)\r\n"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<Figure size 800x550 with 1 Axes>"
      ],
      "image/png": "[encoded data, 20452 characters]"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "63fd5069d213b44bf678585dea6b12cceca9941eaf7f819626cde1f2670de90d"
  },
  "kernelspec": {
   "display_name": "Python 3.9.2 64-bit",
   "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.9.2"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}