{"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":"markdown","source":"### Hi guys! This notebook will slowly enter into competition and achieve high scores.\n\n#### Please support and stay updated.\n\n### This notebook holds analysis and visualization for tracking data of different years. To view analysis and visualizations of Games, Players, Plays, PffScouting data check this notebook -> [NFL complete analysis and visualization!! 🏈](https://www.kaggle.com/zwartfreak/nfl-complete-analysis-and-visualization)\n\n##### P.S. This notebook is not completed yet, building it daily.","metadata":{}},{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n#players = pd.read_csv('../input/nfl-big-data-bowl-2022/players.csv')\n#games = pd.read_csv('../input/nfl-big-data-bowl-2022/games.csv')\n#plays = pd.read_csv('../input/nfl-big-data-bowl-2022/plays.csv')\n#pffscouting = pd.read_csv('../input/nfl-big-data-bowl-2022/PFFScoutingData.csv')\ntracking2018 = pd.read_csv('../input/nfl-big-data-bowl-2022/tracking2018.csv')\ntracking2019 = pd.read_csv('../input/nfl-big-data-bowl-2022/tracking2019.csv')\ntracking2020 = pd.read_csv('../input/nfl-big-data-bowl-2022/tracking2020.csv')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> ## Data anslysis","metadata":{}},{"cell_type":"code","source":"tracking2018.shape, tracking2019.shape,tracking2020.shape","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:14:48.158084Z","iopub.execute_input":"2021-12-29T07:14:48.158524Z","iopub.status.idle":"2021-12-29T07:14:48.171634Z","shell.execute_reply.started":"2021-12-29T07:14:48.158486Z","shell.execute_reply":"2021-12-29T07:14:48.170761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##### These datasets are very huge.\n#### There are different datasets year-wise so we will analyse them one by one.","metadata":{}},{"cell_type":"markdown","source":"### 1. 2018","metadata":{}},{"cell_type":"code","source":"tracking2018.head()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:25:21.582612Z","iopub.execute_input":"2021-12-29T07:25:21.582959Z","iopub.status.idle":"2021-12-29T07:25:21.628167Z","shell.execute_reply.started":"2021-12-29T07:25:21.582922Z","shell.execute_reply":"2021-12-29T07:25:21.627516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2018.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:38:33.05385Z","iopub.execute_input":"2021-12-29T07:38:33.05421Z","iopub.status.idle":"2021-12-29T07:38:43.954984Z","shell.execute_reply.started":"2021-12-29T07:38:33.054177Z","shell.execute_reply":"2021-12-29T07:38:43.954029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##### So there are lots of null values.\n##### 'o' represents Player orientation (deg), 0 - 360 degrees (numeric)\n##### 'dir' represents Angle of player motion (deg), 0 - 360 degrees (numeric)\n##### 'nflId' represents Player identification number, unique across players (numeric)\n##### 'position' represents Player position group (text)\n\n##### Let's drop some data and check the remaining NULL values","metadata":{}},{"cell_type":"code","source":"tracking2018.dropna(subset=['o'], inplace=True)\ntracking2018.isnull().sum().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:51:38.969644Z","iopub.execute_input":"2021-12-29T07:51:38.969984Z","iopub.status.idle":"2021-12-29T07:51:41.749186Z","shell.execute_reply.started":"2021-12-29T07:51:38.969947Z","shell.execute_reply":"2021-12-29T07:51:41.748206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##### As expected, same rows had NULL values to simply dropping will work for us as it is a huge dataset with over 1 crore values.","metadata":{}},{"cell_type":"code","source":"tracking2018.dtypes","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:53:45.248624Z","iopub.execute_input":"2021-12-29T07:53:45.248985Z","iopub.status.idle":"2021-12-29T07:53:45.258395Z","shell.execute_reply.started":"2021-12-29T07:53:45.248948Z","shell.execute_reply":"2021-12-29T07:53:45.257668Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 2. 2019","metadata":{}},{"cell_type":"code","source":"tracking2019.head()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:54:16.112483Z","iopub.execute_input":"2021-12-29T07:54:16.112778Z","iopub.status.idle":"2021-12-29T07:54:16.138945Z","shell.execute_reply.started":"2021-12-29T07:54:16.112749Z","shell.execute_reply":"2021-12-29T07:54:16.138106Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2019.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:54:55.623269Z","iopub.execute_input":"2021-12-29T07:54:55.623689Z","iopub.status.idle":"2021-12-29T07:55:03.764075Z","shell.execute_reply.started":"2021-12-29T07:54:55.62365Z","shell.execute_reply":"2021-12-29T07:55:03.763487Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2019.dropna(subset=['o'], inplace=True)\ntracking2019.isnull().sum().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:55:21.596634Z","iopub.execute_input":"2021-12-29T07:55:21.597506Z","iopub.status.idle":"2021-12-29T07:55:32.325014Z","shell.execute_reply.started":"2021-12-29T07:55:21.597458Z","shell.execute_reply":"2021-12-29T07:55:32.324221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2019.dtypes","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:55:39.566803Z","iopub.execute_input":"2021-12-29T07:55:39.567103Z","iopub.status.idle":"2021-12-29T07:55:39.575742Z","shell.execute_reply.started":"2021-12-29T07:55:39.567061Z","shell.execute_reply":"2021-12-29T07:55:39.574797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 3. 2020","metadata":{}},{"cell_type":"code","source":"tracking2020.head()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:55:59.543281Z","iopub.execute_input":"2021-12-29T07:55:59.543567Z","iopub.status.idle":"2021-12-29T07:55:59.569043Z","shell.execute_reply.started":"2021-12-29T07:55:59.543535Z","shell.execute_reply":"2021-12-29T07:55:59.567751Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2020.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:56:16.856573Z","iopub.execute_input":"2021-12-29T07:56:16.856909Z","iopub.status.idle":"2021-12-29T07:56:25.660391Z","shell.execute_reply.started":"2021-12-29T07:56:16.856871Z","shell.execute_reply":"2021-12-29T07:56:25.658664Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2020.dropna(subset=['o'], inplace=True)\ntracking2020.isnull().sum().sum()","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:56:31.760501Z","iopub.execute_input":"2021-12-29T07:56:31.760768Z","iopub.status.idle":"2021-12-29T07:56:41.581847Z","shell.execute_reply.started":"2021-12-29T07:56:31.760741Z","shell.execute_reply":"2021-12-29T07:56:41.580861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking2020.dtypes","metadata":{"execution":{"iopub.status.busy":"2021-12-29T07:56:45.986847Z","iopub.execute_input":"2021-12-29T07:56:45.987155Z","iopub.status.idle":"2021-12-29T07:56:45.995789Z","shell.execute_reply.started":"2021-12-29T07:56:45.987125Z","shell.execute_reply":"2021-12-29T07:56:45.994908Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> ### NULL values uccessfully treated","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}