{"cells":[{"metadata":{"_uuid":"f787ecf7169bcd7ed18a1e4b5053f5df57f621d3"},"cell_type":"markdown","source":"# Reducing Concussions on Punt Plays\nby Charles Belina and George Ormseth"},{"metadata":{"_uuid":"85cf42cd9497b20cf059ab5874f454f90561ce8d"},"cell_type":"markdown","source":"## I. Data Input & Manipulation"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nfrom collections import Counter\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"# Here I input the revelant data using Pandas.\nvid_rev_DF = pd.read_csv('../input/video_review.csv')\nplayer_data_DF = pd.read_csv('../input/play_player_role_data.csv')\nplay_info_DF = pd.read_csv('../input/play_information.csv')\nplayer_punt_DF = pd.read_csv('../input/player_punt_data.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5b712e80197680d631dc6d968f3e1377d85f91e0"},"cell_type":"code","source":"# Quick test to see what the data looks like.\nvid_rev_DF.tail()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"748eb161f44ec1f0b29cd31910317111070edf69"},"cell_type":"code","source":"# Here I begin to store all of the revelant information in arrays.\nConcussed_position = []; # the position that a concussed player was playing on the punt play\nC_YdLines = []; # the yard line the ball was snapped from on the punt play\nC_Punting_Team = []; # \ntraditional_C_pos = [];\nplayer_number = [];\nplayer_team = [];\nGameIDs = np.array(vid_rev_DF[\"GameKey\"].values);\nPlayIDs = np.array(vid_rev_DF[\"PlayID\"].values);\nGSISIDs = np.array(vid_rev_DF[\"GSISID\"].values);\n\n\nGuard_C_plays=[];\n\nfor i in range(len(GameIDs)):\n    Game = GameIDs[i];\n    Play = PlayIDs[i];\n    Player = GSISIDs[i];\n    \n    Concussed_player_trad_pos = player_punt_DF.loc[(player_punt_DF['GSISID'] == Player)];\n    traditional_C_pos.append(Concussed_player_trad_pos.iloc[0]['Position']);\n    player_number.append(Concussed_player_trad_pos.iloc[0]['Number']);\n    \n   # if \"d\" not in Concussed_player_trad_pos.iloc[0]['Number']:\n   #     player_team.append\n        \n   # else: \n    \n    Concussion_play = play_info_DF.loc[(play_info_DF['PlayID'] == Play)\n                                         & (play_info_DF['GameKey'] == Game)];\n    C_YdLines.append(Concussion_play.iloc[0]['YardLine']);\n    C_Punting_Team.append(Concussion_play.iloc[0]['Poss_Team']);\n    \n    Concussed_player = player_data_DF.loc[(player_data_DF['PlayID'] == Play)\n                                         & (player_data_DF['GameKey'] == Game)\n                                        & (player_data_DF['GSISID'] == Player)];\n    #print(Concussed_player);\n    Concussed_position.append(Concussed_player.iloc[0]['Role']);\n    \n    if ((Concussed_player.iloc[0]['Role']=='PLG') or Concussed_player.iloc[0]['Role']=='PRG'):\n        Guard_C_plays.append(Concussed_player.iloc[0]['PlayID'])\n        #Guard_C_\n","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"a50866498fa5da1b76c57ffc2ea5ccabe80d9309"},"cell_type":"markdown","source":"## II. Data Analysis\n### II.I Concussed Position.\nLets begin by looking at which players are being concussed the most."},{"metadata":{"trusted":true,"_uuid":"7fa32027ce83909721b00a8bd771d494db794e31"},"cell_type":"code","source":"String_counts1 = Counter(Concussed_position)\n\n#frequencies = String_counts.values()\n#names = String_counts.keys()\n\n#x_coordinates = np.arange(len(String_counts))\n#fig = plt.figure()\n#ax = fig.add_subplot(111)\n#ax.bar(x_coordinates, frequencies, align='center')\n#ax.xaxis.set_major_locator(plt.FixedLocator(x_coordinates))\n#ax.xaxis.set_major_formatter(plt.FixedFormatter(names))\n#plt.show()\ndf = pd.DataFrame.from_dict(String_counts1, orient='index')\nplot = df.plot(kind='bar', figsize = (9, 6),\n               title=\"Concussed Player Position on Punt Return\", legend=False,\n                fontsize = 18)\nplot.title.set_size(24);\nplot.set_xlabel(\"Player Position\", fontsize=20);\nplot.set_ylabel(\"Number of Concussions\", fontsize= 20);","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"55c998d51debee2efce7dc5c6463fd4c0c9ecdb1"},"cell_type":"markdown","source":"The above figure shows the number of concussions sustained per position during a punt return. Unsurprisingly, punt returners have suffered the most concussions over the past two years on punt plays; however, the x-axis contains too many positions to glean much more. Let's use a dictionary to group similiar positions under one heading. For example, \"PLT\" and \"PRT\" will now be grouped together under the title \"Tackle.\""},{"metadata":{"trusted":true,"_uuid":"44bb4fd4ae0e99da168dbd8f63ff6d6109c533e7"},"cell_type":"code","source":"Punt_Positions = {\n    # Punt Coverage Positions\n    'PLG': 'Guard',\n    'PRG': 'Guard',\n    'PRT': 'Tackle',\n    'PLT': 'Tackle',\n    'GR': 'Gunner',\n    'GL': 'Gunner',\n    'PRW': 'Wing',\n    'PLW': 'Wing',\n    'PLS': 'Center',\n    'P': 'Punter',\n    'PPR': 'Protector',\n    \n    # Punt Return Positions\n    'PR': 'Returner',\n    'PDR1': 'DLine',\n    'PDR2': 'DLine',\n    'PDR3': 'DLine',\n    'PDL1': 'DLine',\n    'PDL2': 'DLine',\n    'PDL3': 'DLine',\n    'PLR': 'Linebacker',\n    'PLM': 'Linebacker',\n    'PLL': 'Linebacker',\n    'VR': 'Cornerback',\n    'PFB': 'Ret Protector'\n}\n\nPunt_Cov = 0;\nPunt_Ret = 0;","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"825c7d7e3956b3cdfbb5efd5cb9a73119ecb7223"},"cell_type":"code","source":"Concussed_position2 = [Punt_Positions[k] for k in Concussed_position]\n\nfor i in range(len(Concussed_position2)):\n    pos = Concussed_position2[i];\n    if ((pos == 'Guard') or (pos == 'Tackle') or (pos == 'Gunner') or (pos == 'Wing') or (pos == 'Center')\n       or (pos == 'Punter') or (pos == 'Protector')):\n        Punt_Cov += 1;\n    else: Punt_Ret += 1;","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"45e638a1845be3e5d1862948e43703553d5adca2"},"cell_type":"code","source":"String_counts2 = Counter(Concussed_position2)\n\n#frequencies = String_counts.values()\n#names = String_counts.keys()\n\n#x_coordinates = np.arange(len(String_counts))\n#fig = plt.figure()\n#ax = fig.add_subplot(111)\n#ax.bar(x_coordinates, frequencies, align='center')\n#ax.xaxis.set_major_locator(plt.FixedLocator(x_coordinates))\n#ax.xaxis.set_major_formatter(plt.FixedFormatter(names))\n#plt.show()\ndf = pd.DataFrame.from_dict(String_counts2, orient='index')\nplot = df.plot(kind='bar', figsize = (9, 6),\n               title=\"Concussed Player Position on Punt Return\", legend=False,\n                fontsize = 12)\nplot.title.set_size(24);\nplot.set_xlabel(\"Player Position\", fontsize=20);\nplot.set_ylabel(\"Number of Concussions\", fontsize= 20);","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"775516138f03ec8b3a17b6b3441361f3fa310204"},"cell_type":"markdown","source":"After seeing this, we were surprised at the number of guards being concussed. It was surprising because (i) guards tend to be slower players and (ii) they on the coverage team, not the return team. We then decided to look which team (return or coverage) was sustaining the most concussions. "},{"metadata":{"trusted":true,"_uuid":"24891f1c723557476c3a7b938101f183b3c4c67b"},"cell_type":"code","source":"plt.pie([Punt_Cov, Punt_Ret], explode=(0.1, 0), labels=('Coverage Team', 'Return Team'),\n        autopct='%1.1f%%', shadow=True, startangle=180);\nplt.axis('equal');\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"c928785ee79f8efa906160d7bc3847d8c3fb9aac"},"cell_type":"markdown","source":"The fact that the coverage team sustains nearly 3/4 of concussions was very surprising and left us ready to watch the videos to see why coverage players were being injured at a much higher clip."},{"metadata":{"_uuid":"94e74d23c4cf906d4e57151c1a9e6056cc2275a4"},"cell_type":"markdown","source":"### II.II Video Analysis\nAfter determining that (i) guards are sustaining a disproportionate number of concussions and that (ii) players on the coverage team were suffering a majority of the cvoncussions, we began to watch the videos of the plays which had resulted in concussions.\n\nThe videos immediately showed that guards (and oftentimes other players sustaining concussions) were in fact injuring themselves. In attempts to tackle or block an oppenent, they would leave their feet and launch in situations where they could have come to balance before making the tackle or attempting a block."},{"metadata":{"_uuid":"fc58610d75cc8103942e1b179bc1858ef033d3cd"},"cell_type":"markdown","source":"## III. Rule Change\nWith this in mind, we propose to **eliminate any form of launching on punt plays.** Currently, the NFL states that launching is only a penalty if it is done to a defenseless player. We believe the NFL should expand this rule to apply to all players, *whether defenseless or not*, during a punt play.\n\nAfter a player leaves his feet, he no longer has control over what he will hit. On punts, this becomes especially dangerous because the play is faster than a standard play and much can change after a player has launched.\n\nAfter watching each concussion video many times, we estimated that **32.4% of concussions could have been prevented if a player had not launched.** This amounts to 12 of the 37 concussions.\n"},{"metadata":{"trusted":true,"_uuid":"d6794c963c6c45c75fe72c096c38794d7f6cb16e"},"cell_type":"code","source":"plt.pie([12, 25], explode=(0.1, 0), labels=('Launch Plays', 'Other'),\n        autopct='%1.1f%%', shadow=True, startangle=180);\nplt.axis('equal');\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"89e20f4c10c16c8159ce5d7fbc3c0bfa825450dd"},"cell_type":"markdown","source":"For reference, the Game and Play IDs of the concussion plays that were caused by a launch are given below."},{"metadata":{"trusted":true,"_uuid":"ab659cde51d81910e6f93c380a1cab5c36dae6b8"},"cell_type":"code","source":"C_plays = {'Game ID': [5, 29, 189, 231, 234, 281, 296, 357, 384, 506, 553, 618],\n     'Play ID': [3129, 538, 3509, 1976, 3278, 1521, 2667, 3630, 183, 1988, 1683, 2792]}\nC_plays_df = pd.DataFrame(data=C_plays)\nC_plays_df","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"149379c98f40594c6670e339be2c566dfe73ef57"},"cell_type":"markdown","source":"## IV. Conclusion\n\nAfter seeing that coverage players were injuring themselves at a much higher clip than return players, we turned to the videos and understood that this was happening because coverage players tend to launch and inadvertently injure themselves. Under the current NFL rules, launching is only illegal if it is done to a defenseless player. We imagine that this was instituted to protect the defenseless player, but on punt plays, it is oftentimes the launcher who is injured.\n\nIn order to protect tacklers and blockers from concussions, they should be discouraged from launching in any way. We thus propose **eliminating any form of launching** and believe that this could lead to a **30% reduction in concussions on punt plays**. "},{"metadata":{"trusted":true,"_uuid":"0c2166abb78cbf476e5c80a8954142c1d4cdc5f9"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}