{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n%matplotlib inline\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T04:59:58.918003Z","iopub.execute_input":"2022-01-13T04:59:58.918489Z","iopub.status.idle":"2022-01-13T04:59:58.926214Z","shell.execute_reply.started":"2022-01-13T04:59:58.918445Z","shell.execute_reply":"2022-01-13T04:59:58.925333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games = pd.read_csv('../input/nfl-big-data-bowl-2022/games.csv')\ngames.head()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T04:59:58.928907Z","iopub.execute_input":"2022-01-13T04:59:58.929275Z","iopub.status.idle":"2022-01-13T04:59:58.954316Z","shell.execute_reply.started":"2022-01-13T04:59:58.929227Z","shell.execute_reply":"2022-01-13T04:59:58.953711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**<font size=5> EDA for games </font>**","metadata":{}},{"cell_type":"code","source":"games.info()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:01.139292Z","iopub.execute_input":"2022-01-13T05:00:01.140085Z","iopub.status.idle":"2022-01-13T05:00:01.167557Z","shell.execute_reply.started":"2022-01-13T05:00:01.140044Z","shell.execute_reply":"2022-01-13T05:00:01.166050Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Splliting YYMMDD\n\ngames['Month'] = games['gameDate'].apply(lambda x: int(x.split('/')[0]))\ngames['Day'] = games['gameDate'].apply(lambda x: int(x.split('/')[1]))\ngames['hour'] = games['gameTimeEastern'].apply(lambda x: int(x.split(':')[0]))","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:01.725972Z","iopub.execute_input":"2022-01-13T05:00:01.727079Z","iopub.status.idle":"2022-01-13T05:00:01.739797Z","shell.execute_reply.started":"2022-01-13T05:00:01.727013Z","shell.execute_reply":"2022-01-13T05:00:01.738388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games.head()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:02.545310Z","iopub.execute_input":"2022-01-13T05:00:02.546542Z","iopub.status.idle":"2022-01-13T05:00:02.560404Z","shell.execute_reply.started":"2022-01-13T05:00:02.546476Z","shell.execute_reply":"2022-01-13T05:00:02.559260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**<font size=\"5\">Function for writing percent at the top of the bar graph</font>**","metadata":{}},{"cell_type":"code","source":"def write_percent(ax, total_size):\n    '''Traverse the figure object and display the ratio at the top of the bar graph.'''\n    for patch in ax.patches:\n        height = patch.get_height() # Figure height (number of data)\n        width = patch.get_width() # Figure width\n        left_coord = patch.get_x() # The x-axis position on the left edge of the figure\n        percent = height/total_size*100 # percent\n        \n        # Type text in the (x, y) coordinates\n        ax.text(x=left_coord + width/2.0, # x-axis position\n                y=height + total_size*0.001, # y-axis position\n                s=f'{percent:1.1f}%', # Text\n                ha='center') # in the middle\n","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:04.144331Z","iopub.execute_input":"2022-01-13T05:00:04.144683Z","iopub.status.idle":"2022-01-13T05:00:04.151896Z","shell.execute_reply.started":"2022-01-13T05:00:04.144648Z","shell.execute_reply":"2022-01-13T05:00:04.151136Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15) # Set font size\nplt.figure(figsize=(7, 6)) # Set figure size\n\nax = sns.countplot(x='season', data=games)\nwrite_percent(ax, len(games)) \nax.set_title('Number of games for season');","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:06.386089Z","iopub.execute_input":"2022-01-13T05:00:06.386584Z","iopub.status.idle":"2022-01-13T05:00:06.638100Z","shell.execute_reply.started":"2022-01-13T05:00:06.386528Z","shell.execute_reply":"2022-01-13T05:00:06.636984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15)\nplt.figure(figsize=(8,6))\nax = sns.countplot(x='Month', data=games)\nwrite_percent(ax, len(games))\nax.set_title('Number of games for month')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:07.574718Z","iopub.execute_input":"2022-01-13T05:00:07.575057Z","iopub.status.idle":"2022-01-13T05:00:07.757556Z","shell.execute_reply.started":"2022-01-13T05:00:07.575024Z","shell.execute_reply":"2022-01-13T05:00:07.756184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12)\nplt.figure(figsize=(16,9))\n\nax = sns.countplot(x='Day', data=games)\nwrite_percent(ax, len(games))\nax.set_title(\"Number of games for day\")","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:09.052454Z","iopub.execute_input":"2022-01-13T05:00:09.053109Z","iopub.status.idle":"2022-01-13T05:00:09.640789Z","shell.execute_reply.started":"2022-01-13T05:00:09.053068Z","shell.execute_reply":"2022-01-13T05:00:09.639901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15) \nplt.figure(figsize=(15, 7))\n\nax = sns.countplot(x='gameTimeEastern', data=games)\nwrite_percent(ax, len(games))\nax.set_title('Number of games for gameTimeEastern');\nax.tick_params('x', labelrotation=30) # rotate 30 degree of x label","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:11.515554Z","iopub.execute_input":"2022-01-13T05:00:11.516363Z","iopub.status.idle":"2022-01-13T05:00:11.873192Z","shell.execute_reply.started":"2022-01-13T05:00:11.516207Z","shell.execute_reply":"2022-01-13T05:00:11.872245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12) \nplt.figure(figsize=(15, 7))\n\nax = sns.countplot(x='hour', data=games)\nwrite_percent(ax, len(games))\nax.set_title('Number of games for hour');","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:12.252855Z","iopub.execute_input":"2022-01-13T05:00:12.253774Z","iopub.status.idle":"2022-01-13T05:00:12.518149Z","shell.execute_reply.started":"2022-01-13T05:00:12.253716Z","shell.execute_reply":"2022-01-13T05:00:12.517449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12) \nplt.figure(figsize=(15, 7))\n\nax = sns.countplot(x='week', data=games)\nwrite_percent(ax, len(games))\nax.set_title('Number of games for week');","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:13.146344Z","iopub.execute_input":"2022-01-13T05:00:13.146977Z","iopub.status.idle":"2022-01-13T05:00:13.459656Z","shell.execute_reply.started":"2022-01-13T05:00:13.146913Z","shell.execute_reply":"2022-01-13T05:00:13.459016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**<font size=5> EDA for Player Data</font>**","metadata":{}},{"cell_type":"code","source":"players = pd.read_csv('../input/nfl-big-data-bowl-2022/players.csv')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:14.872848Z","iopub.execute_input":"2022-01-13T05:00:14.873171Z","iopub.status.idle":"2022-01-13T05:00:14.897723Z","shell.execute_reply.started":"2022-01-13T05:00:14.873136Z","shell.execute_reply":"2022-01-13T05:00:14.896545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players","metadata":{"scrolled":true,"execution":{"iopub.status.busy":"2022-01-13T05:00:19.684974Z","iopub.execute_input":"2022-01-13T05:00:19.685596Z","iopub.status.idle":"2022-01-13T05:00:19.710687Z","shell.execute_reply.started":"2022-01-13T05:00:19.685556Z","shell.execute_reply":"2022-01-13T05:00:19.709993Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players.info()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:19.953174Z","iopub.execute_input":"2022-01-13T05:00:19.953471Z","iopub.status.idle":"2022-01-13T05:00:19.969410Z","shell.execute_reply.started":"2022-01-13T05:00:19.953439Z","shell.execute_reply":"2022-01-13T05:00:19.968734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<font size=3> Convert all heights to inch </font>","metadata":{}},{"cell_type":"code","source":"players['height'].value_counts() # Some heights are already converted to inches","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:21.853019Z","iopub.execute_input":"2022-01-13T05:00:21.853424Z","iopub.status.idle":"2022-01-13T05:00:21.862370Z","shell.execute_reply.started":"2022-01-13T05:00:21.853392Z","shell.execute_reply":"2022-01-13T05:00:21.861411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"height_2in = players['height'].str.split('-', expand=True)\nheight_2in","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:22.192773Z","iopub.execute_input":"2022-01-13T05:00:22.193281Z","iopub.status.idle":"2022-01-13T05:00:22.211428Z","shell.execute_reply.started":"2022-01-13T05:00:22.193227Z","shell.execute_reply":"2022-01-13T05:00:22.210633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"height_2in.columns = ['first', 'second'] # column alias\nlen(height_2in.index[height_2in['second'].isnull()].tolist()) # if height_2in['second'] is null then this data is already convereted to inches","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:23.489274Z","iopub.execute_input":"2022-01-13T05:00:23.489683Z","iopub.status.idle":"2022-01-13T05:00:23.497131Z","shell.execute_reply.started":"2022-01-13T05:00:23.489651Z","shell.execute_reply":"2022-01-13T05:00:23.496018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"height_2in.loc[height_2in['second'].notnull() ,'first'] = (height_2in[height_2in['second'].notnull()]['first'].astype(np.int16) * 12) + height_2in[height_2in['second'].notnull()]['second'].astype(np.int16)\n                                                           ","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:23.791417Z","iopub.execute_input":"2022-01-13T05:00:23.791687Z","iopub.status.idle":"2022-01-13T05:00:23.805526Z","shell.execute_reply.started":"2022-01-13T05:00:23.791659Z","shell.execute_reply":"2022-01-13T05:00:23.804424Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"height_2in[height_2in['second'].notnull()]","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:24.728665Z","iopub.execute_input":"2022-01-13T05:00:24.729171Z","iopub.status.idle":"2022-01-13T05:00:24.742432Z","shell.execute_reply.started":"2022-01-13T05:00:24.729123Z","shell.execute_reply":"2022-01-13T05:00:24.741616Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players['height'] = height_2in['first']","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:24.953400Z","iopub.execute_input":"2022-01-13T05:00:24.953717Z","iopub.status.idle":"2022-01-13T05:00:24.959445Z","shell.execute_reply.started":"2022-01-13T05:00:24.953685Z","shell.execute_reply":"2022-01-13T05:00:24.958020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:26.237874Z","iopub.execute_input":"2022-01-13T05:00:26.238832Z","iopub.status.idle":"2022-01-13T05:00:26.258610Z","shell.execute_reply.started":"2022-01-13T05:00:26.238765Z","shell.execute_reply":"2022-01-13T05:00:26.257643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16,9))\nax = sns.distplot(players['height'], bins=12)\nax.set_title('Height Distribution')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:26.601750Z","iopub.execute_input":"2022-01-13T05:00:26.602020Z","iopub.status.idle":"2022-01-13T05:00:26.863343Z","shell.execute_reply.started":"2022-01-13T05:00:26.601991Z","shell.execute_reply":"2022-01-13T05:00:26.862431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16,9))\nax = sns.distplot(players['weight'], bins=12)","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:27.798209Z","iopub.execute_input":"2022-01-13T05:00:27.798492Z","iopub.status.idle":"2022-01-13T05:00:28.042134Z","shell.execute_reply.started":"2022-01-13T05:00:27.798459Z","shell.execute_reply":"2022-01-13T05:00:28.041021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"top_college = players['collegeName'].value_counts()[:20].reset_index()\ntop_college.columns = ['collegeName', 'NumberOfPlayers']\ntop_college","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:28.048442Z","iopub.execute_input":"2022-01-13T05:00:28.048724Z","iopub.status.idle":"2022-01-13T05:00:28.064559Z","shell.execute_reply.started":"2022-01-13T05:00:28.048694Z","shell.execute_reply":"2022-01-13T05:00:28.063411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16,9))\nax = sns.barplot(data=top_college, x='NumberOfPlayers', y='collegeName')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:28.878310Z","iopub.execute_input":"2022-01-13T05:00:28.878596Z","iopub.status.idle":"2022-01-13T05:00:29.340013Z","shell.execute_reply.started":"2022-01-13T05:00:28.878567Z","shell.execute_reply":"2022-01-13T05:00:29.339026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"top_position = players['Position'].value_counts()[:10].reset_index()\n#top_college.columns = ['collegeName', 'NumberOfPlayers']\ntop_position","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.341708Z","iopub.execute_input":"2022-01-13T05:00:29.341959Z","iopub.status.idle":"2022-01-13T05:00:29.353662Z","shell.execute_reply.started":"2022-01-13T05:00:29.341915Z","shell.execute_reply":"2022-01-13T05:00:29.353015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot(data=top_position, x='index', y='Position')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.354792Z","iopub.execute_input":"2022-01-13T05:00:29.355124Z","iopub.status.idle":"2022-01-13T05:00:29.574889Z","shell.execute_reply.started":"2022-01-13T05:00:29.355096Z","shell.execute_reply":"2022-01-13T05:00:29.573901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players['birthYear'] = 0\nplayers","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.576486Z","iopub.execute_input":"2022-01-13T05:00:29.576706Z","iopub.status.idle":"2022-01-13T05:00:29.597862Z","shell.execute_reply.started":"2022-01-13T05:00:29.576680Z","shell.execute_reply":"2022-01-13T05:00:29.597194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players.dropna(subset=['birthDate'], inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.599308Z","iopub.execute_input":"2022-01-13T05:00:29.599703Z","iopub.status.idle":"2022-01-13T05:00:29.609073Z","shell.execute_reply.started":"2022-01-13T05:00:29.599660Z","shell.execute_reply":"2022-01-13T05:00:29.608188Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players.info()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.633956Z","iopub.execute_input":"2022-01-13T05:00:29.634271Z","iopub.status.idle":"2022-01-13T05:00:29.650080Z","shell.execute_reply.started":"2022-01-13T05:00:29.634241Z","shell.execute_reply":"2022-01-13T05:00:29.649169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#players['birthDate'] = players.apply(lambda x: x['birthDate'].split('/'), axis=1)\nfor idx, row in players.iterrows():\n    if len(row['birthDate'].split('/')) == 3: # ex) 05/17/1994 \n        players.loc[idx, 'birthYear'] = row['birthDate'].split('/')[2]\n        \n    elif len(row['birthDate'].split('-')) == 3: # ex) 1995-05-05\n        players.loc[idx, 'birthYear'] = row['birthDate'].split('-')[0]\nplayers","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:29.787600Z","iopub.execute_input":"2022-01-13T05:00:29.787923Z","iopub.status.idle":"2022-01-13T05:00:30.743313Z","shell.execute_reply.started":"2022-01-13T05:00:29.787888Z","shell.execute_reply":"2022-01-13T05:00:30.742299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15)\nplt.figure(figsize=(16,9))\nax = sns.distplot(players['birthYear'], bins=25)\nax.set_title('Players birth year')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:30.745204Z","iopub.execute_input":"2022-01-13T05:00:30.745586Z","iopub.status.idle":"2022-01-13T05:00:31.043888Z","shell.execute_reply.started":"2022-01-13T05:00:30.745535Z","shell.execute_reply":"2022-01-13T05:00:31.042997Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players['birthYear'].min(), players['birthYear'].max()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.045325Z","iopub.execute_input":"2022-01-13T05:00:31.045631Z","iopub.status.idle":"2022-01-13T05:00:31.053396Z","shell.execute_reply.started":"2022-01-13T05:00:31.045589Z","shell.execute_reply":"2022-01-13T05:00:31.052431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**<font size=5> EDA for Play Data </font>**","metadata":{}},{"cell_type":"code","source":"plays = pd.read_csv('../input/nfl-big-data-bowl-2022/plays.csv')\nplays","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.055647Z","iopub.execute_input":"2022-01-13T05:00:31.056044Z","iopub.status.idle":"2022-01-13T05:00:31.252353Z","shell.execute_reply.started":"2022-01-13T05:00:31.055995Z","shell.execute_reply":"2022-01-13T05:00:31.251534Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plays.info()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.253851Z","iopub.execute_input":"2022-01-13T05:00:31.254339Z","iopub.status.idle":"2022-01-13T05:00:31.287291Z","shell.execute_reply.started":"2022-01-13T05:00:31.254298Z","shell.execute_reply":"2022-01-13T05:00:31.286455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12)\nplt.figure(figsize=(16,9))\nax = sns.countplot(x='quarter', data=plays)\nwrite_percent(ax, len(plays)) \nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.288803Z","iopub.execute_input":"2022-01-13T05:00:31.289131Z","iopub.status.idle":"2022-01-13T05:00:31.455315Z","shell.execute_reply.started":"2022-01-13T05:00:31.289090Z","shell.execute_reply":"2022-01-13T05:00:31.454326Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plays['quarter'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.456988Z","iopub.execute_input":"2022-01-13T05:00:31.457298Z","iopub.status.idle":"2022-01-13T05:00:31.465280Z","shell.execute_reply.started":"2022-01-13T05:00:31.457258Z","shell.execute_reply":"2022-01-13T05:00:31.464244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12)\nplt.figure(figsize=(16,9))\nax = sns.countplot(x='down', data=plays)\nwrite_percent(ax, len(plays)) \nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.468150Z","iopub.execute_input":"2022-01-13T05:00:31.468469Z","iopub.status.idle":"2022-01-13T05:00:31.636086Z","shell.execute_reply.started":"2022-01-13T05:00:31.468429Z","shell.execute_reply":"2022-01-13T05:00:31.635156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=12) \nplt.figure(figsize=(12, 6))\n\nax = sns.countplot(x='yardsToGo', data=plays)\n#write_percent(ax, len(plays)) \nax.set_title('Number of plays for every yards to go category');","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:31.637630Z","iopub.execute_input":"2022-01-13T05:00:31.637998Z","iopub.status.idle":"2022-01-13T05:00:32.051099Z","shell.execute_reply.started":"2022-01-13T05:00:31.637954Z","shell.execute_reply":"2022-01-13T05:00:32.050206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15) \nplt.figure(figsize=(10, 5))\nplt.grid(True)\nax = sns.distplot(plays['playResult'], bins=25)\n\nax.set_title('playResult Distribution')","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:32.053482Z","iopub.execute_input":"2022-01-13T05:00:32.054617Z","iopub.status.idle":"2022-01-13T05:00:32.481790Z","shell.execute_reply.started":"2022-01-13T05:00:32.054561Z","shell.execute_reply":"2022-01-13T05:00:32.481149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rc('font', size=15) \nplt.figure(figsize=(10, 5))\nplt.grid(True)\nax = sns.distplot(plays['preSnapHomeScore'], bins=12);\nax.set_title('preSnapHomeScore Distribution'); ","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:32.482748Z","iopub.execute_input":"2022-01-13T05:00:32.483463Z","iopub.status.idle":"2022-01-13T05:00:32.839092Z","shell.execute_reply.started":"2022-01-13T05:00:32.483423Z","shell.execute_reply":"2022-01-13T05:00:32.838296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**<font size=5> EDA for Tracking Data</font>**","metadata":{}},{"cell_type":"code","source":"tracking2018 = pd.read_csv('../input/nfl-big-data-bowl-2022/tracking2018.csv')\ntracking2018.sample(10)","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:00:32.840219Z","iopub.execute_input":"2022-01-13T05:00:32.840543Z","iopub.status.idle":"2022-01-13T05:01:25.773675Z","shell.execute_reply.started":"2022-01-13T05:00:32.840510Z","shell.execute_reply":"2022-01-13T05:01:25.773025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2018.info()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:01:25.775490Z","iopub.execute_input":"2022-01-13T05:01:25.776128Z","iopub.status.idle":"2022-01-13T05:01:25.789299Z","shell.execute_reply.started":"2022-01-13T05:01:25.776096Z","shell.execute_reply":"2022-01-13T05:01:25.787629Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(16,9))\ntracking2018.loc[(tracking2018['gameId']==2018123000) & (tracking2018['playId']==36), ['x','y', 'team']] \\\n                .groupby(tracking2018['team']).plot(x='x', y='y', ax=ax, style='.')\nplt.legend().remove()\nplt.grid(True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:02:36.140449Z","iopub.execute_input":"2022-01-13T05:02:36.140830Z","iopub.status.idle":"2022-01-13T05:02:36.424416Z","shell.execute_reply.started":"2022-01-13T05:02:36.140792Z","shell.execute_reply":"2022-01-13T05:02:36.423578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(16,9))\ntracking2018.loc[(tracking2018['gameId']==2018091609) & (tracking2018['position']=='CB'), ['x','y']] \\\n                .groupby(tracking2018['team']).plot(x='x', y='y', ax=ax, style='.')\nplt.legend().remove()\nplt.grid(True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-13T05:01:26.081828Z","iopub.execute_input":"2022-01-13T05:01:26.082619Z","iopub.status.idle":"2022-01-13T05:01:28.234207Z","shell.execute_reply.started":"2022-01-13T05:01:26.082575Z","shell.execute_reply":"2022-01-13T05:01:28.233345Z"},"trusted":true},"execution_count":null,"outputs":[]}]}