{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"markdown","source":"**The Challenge**\n\n\nFor the 2018 season, the NFL revised their kickoff rules in an effort to reduce the risk of injury during those plays. By examining injury reports, player position and velocity data, and game video, they were able to understand the game-play circumstances that may exacerbate the risk of injury to players.\n\nThis comprehensive review showed that over the course of all games during the 2015-2017 seasons, the kickoff represented only six percent of plays but 12 percent of concussions. Players had approximately four times the risk of concussion on returned kickoffs compared to running or passing plays. The changes to the kickoff rule aim to address the components that posed the most risk, like the use of a two-man wedge.\n\nNow, the NFL is challenging Kagglers to help them perform the same examination, this time on punt play rules. They have provided data for all punt plays from the 2016 and 2017 NFL seasons that includes player rosters, on-field position data and video data, including the plays in which a player suffered a concussion.\n\nYour challenge is to propose specific rule modifications (e.g. changes to the initial formation, tackling techniques, blocking rules etc.), supported by data, that may reduce the occurrence of concussions during punt plays. More details on the entry criteria are available in Overview tab > Evaluation.\n\n**About The NFL**\n\n\nThe National Football League is America's most popular sports league, comprised of 32 franchises that compete each year to win the Super Bowl, the world's biggest annual sporting event. Founded in 1920, the NFL developed the model for the successful modern sports league, including national and international distribution, extensive revenue sharing, competitive excellence, and strong franchises across the country.\n\nThe NFL is committed to advancing progress in the diagnosis, prevention and treatment of sports-related injuries. The NFL's ongoing health and safety efforts include support for independent medical research and engineering advancements and a commitment to look at anything and everything to protect players and make the game safer, including enhancements to medical protocols and improvements to how our game is taught and played.\n\nAs more is learned, the league evaluates and changes rules to evolve the game and try to improve protections for players. Since 2002 alone, the NFL has made 50 rules changes intended to eliminate potentially dangerous tactics and reduce the risk of injuries.\n\nFor more information about the NFL's health and safety efforts, please visit www.PlaySmartPlaySafe.com."},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport warnings\nwarnings.filterwarnings('ignore')\nfrom plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot\nimport cufflinks as cf\ninit_notebook_mode(connected = True)\ncf.go_offline()\n%matplotlib inline\n\nfrom plotly import tools\nimport plotly.plotly as py\nfrom plotly.offline import init_notebook_mode, iplot\ninit_notebook_mode(connected=True)\nimport plotly.graph_objs as go\nimport plotly.figure_factory as ff\nimport plotly.offline as offline\n# Squarify for treemaps\nimport squarify\n# Random for well, random stuff\nimport random\n# operator for sorting dictionaries\nimport operator\n# For ignoring warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n\n\nvideo_review = pd.read_csv('../input/video_review.csv')\nvideo_review.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c23fe31389d615a242f80cfcd1fbadcc42fbfdc5"},"cell_type":"code","source":"video_review.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6c7bb71e00fe7dfd440543bb8ccf108509c9aff2"},"cell_type":"code","source":"video_review.describe()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"36be5de87b246ec2ddf6c66c6b7551b5c1e180ec"},"cell_type":"code","source":"# Player activity during primary injury causing event\n\n\n\ntemp = video_review[\"Player_Activity_Derived\"].value_counts()\nfig = {\n  \"data\": [\n    {\n      \"values\": temp.values,\n      \"labels\": temp.index,\n      \"domain\": {\"x\": [0, 1]},\n      \"hole\": .6,\n      \"type\": \"pie\"\n    },\n    \n    ],\n  \"layout\": {\n        \"title\":\"Player activity during primary injury causing event\",\n        \"annotations\": [\n            {\n                \"font\": {\n                    \"size\": 17\n                },\n                \"showarrow\": False,\n                \"text\": \"Player activity\",\n                \"x\": 0.5,\n                \"y\": 0.5\n            }\n            \n        ]\n    }\n}\niplot(fig, filename='donut')","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"4b2ec70f98396366b5f38acb43409751a73f5e21"},"cell_type":"code","source":"# Primary_Impact_Type\n\n\ntemp = video_review[\"Primary_Impact_Type\"].value_counts()\nfig = {\n  \"data\": [\n    {\n      \"values\": temp.values,\n      \"labels\": temp.index,\n      \"domain\": {\"x\": [0, 1]},\n      \"hole\": .6,\n      \"type\": \"pie\"\n    },\n    \n    ],\n  \"layout\": {\n        \"title\":\"Impacting source that caused the concussion\",\n        \"annotations\": [\n            {\n                \"font\": {\n                    \"size\": 17\n                },\n                \"showarrow\": False,\n                \"text\": \"Primary Impact type\",\n                \"x\": 0.5,\n                \"y\": 0.5\n            }\n            \n        ]\n    }\n}\niplot(fig, filename='donut')","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"fee08fb412c34253e129e2f30acba2c504649bb5"},"cell_type":"code","source":"# Game data\n\ngame_data = pd.read_csv('../input/game_data.csv')\ngame_data.head(2)","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"121d8c67f8c653e2e0d93dc08e719bed193ad32c"},"cell_type":"code","source":"cnt_srs = game_data['Turf'].value_counts()\n\ntrace = go.Bar(\n    x=cnt_srs.index,\n    y=cnt_srs.values,\n    marker=dict(\n        color=cnt_srs.values,\n    ),\n)\n\nlayout = go.Layout(\n    title='Turf type'\n)\n\ndata = [trace]\nfig = go.Figure(data=data, layout=layout)\noffline.iplot(fig, filename=\"Ratio\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"567f13a244bfaa647e874b568a99a43faa2a0d45"},"cell_type":"code","source":"cnt_srs = game_data['Start_Time'].value_counts()\n\ntrace = go.Bar(\n    x=cnt_srs.index,\n    y=cnt_srs.values,\n    marker=dict(\n        color=cnt_srs.values,\n    ),\n)\n\nlayout = go.Layout(\n    title='Start time'\n)\n\ndata = [trace]\nfig = go.Figure(data=data, layout=layout)\noffline.iplot(fig, filename=\"Ratio\")","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"2f9beb1361452312006af3782605b9e935cdf394"},"cell_type":"markdown","source":".....to be continued"},{"metadata":{"trusted":true,"_uuid":"da9ecbad51ad284bc20773fd92a66eefc22e1903"},"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}