{"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":"### Hello everyone this is my first notebook to share, just 2 EDA libraries plugged into the datasets to get some insights, I hope some of you may find it useful. :)","metadata":{}},{"cell_type":"code","source":"!pip install sweetviz # Installing sweetviz here","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Some imports, I imported msno here for missing values but \n# it turns out we don't really need it here.\nimport pandas as pd\nimport numpy as np\nimport missingno as msno","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:36:11.870283Z","iopub.execute_input":"2022-12-06T13:36:11.870759Z","iopub.status.idle":"2022-12-06T13:36:11.964678Z","shell.execute_reply.started":"2022-12-06T13:36:11.870726Z","shell.execute_reply":"2022-12-06T13:36:11.963664Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Reading data\ntest_video_metadata = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/test_video_metadata.csv\")\ntest_baseline_helmets = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/test_baseline_helmets.csv\")\ntest_player_tracking = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/test_player_tracking.csv\")\n\ntrain_baseline_helmets = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/train_baseline_helmets.csv\")\ntrain_video_metadata = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/train_video_metadata.csv\")\ntrain_player_tracking = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/train_player_tracking.csv\")\ntrain_labels = pd.read_csv(\"/kaggle/input/nfl-player-contact-detection/train_labels.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:31:43.913698Z","iopub.execute_input":"2022-12-06T13:31:43.914736Z","iopub.status.idle":"2022-12-06T13:32:10.532437Z","shell.execute_reply.started":"2022-12-06T13:31:43.914692Z","shell.execute_reply":"2022-12-06T13:32:10.530297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Taking a look at our tracking data.\ntrain_player_tracking.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:37:49.215395Z","iopub.execute_input":"2022-12-06T13:37:49.215905Z","iopub.status.idle":"2022-12-06T13:37:49.256209Z","shell.execute_reply.started":"2022-12-06T13:37:49.215870Z","shell.execute_reply":"2022-12-06T13:37:49.254490Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# No nulls for this data frame\ntrain_player_tracking.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:41:52.897602Z","iopub.execute_input":"2022-12-06T13:41:52.898312Z","iopub.status.idle":"2022-12-06T13:41:53.845540Z","shell.execute_reply.started":"2022-12-06T13:41:52.898274Z","shell.execute_reply":"2022-12-06T13:41:53.844309Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# No nulls for this data frame\ntrain_baseline_helmets.isnull().sum()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# No NaNs for this data frame\ntrain_player_tracking.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:39:08.318847Z","iopub.execute_input":"2022-12-06T13:39:08.319311Z","iopub.status.idle":"2022-12-06T13:39:08.611297Z","shell.execute_reply.started":"2022-12-06T13:39:08.319276Z","shell.execute_reply":"2022-12-06T13:39:08.609722Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# As was seen above, since we don't have any missing data;\n# Our missing data visualization is also quite useless.\nmsno.matrix(train_player_tracking)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:39:23.255971Z","iopub.execute_input":"2022-12-06T13:39:23.256441Z","iopub.status.idle":"2022-12-06T13:39:33.749811Z","shell.execute_reply.started":"2022-12-06T13:39:23.256406Z","shell.execute_reply":"2022-12-06T13:39:33.747727Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:54:07.051843Z","iopub.execute_input":"2022-12-06T13:54:07.052487Z","iopub.status.idle":"2022-12-06T13:54:07.059550Z","shell.execute_reply.started":"2022-12-06T13:54:07.052435Z","shell.execute_reply":"2022-12-06T13:54:07.058263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Correlations in train_player_tracking frame\nsns.heatmap(train_player_tracking.corr(), annot = True, fmt = \".3f\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:54:26.740460Z","iopub.execute_input":"2022-12-06T13:54:26.740942Z","iopub.status.idle":"2022-12-06T13:54:28.585202Z","shell.execute_reply.started":"2022-12-06T13:54:26.740903Z","shell.execute_reply":"2022-12-06T13:54:28.583989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Correlations in train_baseline_helmets frame \nsns.heatmap(train_baseline_helmets.corr(), annot = True, fmt = \".3f\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:54:51.270330Z","iopub.execute_input":"2022-12-06T13:54:51.270851Z","iopub.status.idle":"2022-12-06T13:54:52.941280Z","shell.execute_reply.started":"2022-12-06T13:54:51.270811Z","shell.execute_reply":"2022-12-06T13:54:52.939868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Given we are about to get a detailed profiling report the correlation maps above are not important, pandas profiling for example providing several correlation reports for the data automatically.","metadata":{}},{"cell_type":"code","source":"# Imports\nimport pandas_profiling as pp\nimport sweetviz as sv","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:43:26.091567Z","iopub.execute_input":"2022-12-06T13:43:26.092299Z","iopub.status.idle":"2022-12-06T13:43:26.099305Z","shell.execute_reply.started":"2022-12-06T13:43:26.092254Z","shell.execute_reply":"2022-12-06T13:43:26.097646Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Pandas Profiling Reports","metadata":{}},{"cell_type":"code","source":"#First report initialized\nreport_player_tracking=pp.ProfileReport(train_player_tracking)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:43:57.219991Z","iopub.execute_input":"2022-12-06T13:43:57.220620Z","iopub.status.idle":"2022-12-06T13:43:57.231019Z","shell.execute_reply.started":"2022-12-06T13:43:57.220571Z","shell.execute_reply":"2022-12-06T13:43:57.229229Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#First report generated\nreport_player_tracking","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:44:04.450494Z","iopub.execute_input":"2022-12-06T13:44:04.451051Z","iopub.status.idle":"2022-12-06T13:47:16.368224Z","shell.execute_reply.started":"2022-12-06T13:44:04.451012Z","shell.execute_reply":"2022-12-06T13:47:16.367188Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Second report initialized\nreport_train_baseline_helmets=pp.ProfileReport(train_baseline_helmets)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:49:11.848621Z","iopub.execute_input":"2022-12-06T13:49:11.849083Z","iopub.status.idle":"2022-12-06T13:49:11.857112Z","shell.execute_reply.started":"2022-12-06T13:49:11.849048Z","shell.execute_reply":"2022-12-06T13:49:11.855784Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Second report generated\nreport_train_baseline_helmets","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:49:16.702016Z","iopub.execute_input":"2022-12-06T13:49:16.702500Z","iopub.status.idle":"2022-12-06T13:52:36.940567Z","shell.execute_reply.started":"2022-12-06T13:49:16.702464Z","shell.execute_reply":"2022-12-06T13:52:36.937392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## SweetViz Reports","metadata":{}},{"cell_type":"code","source":"#First SV report generated\nsv_t_p_tracking=sv.analyze(train_player_tracking)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:56:28.842091Z","iopub.execute_input":"2022-12-06T13:56:28.842636Z","iopub.status.idle":"2022-12-06T13:57:25.840963Z","shell.execute_reply.started":"2022-12-06T13:56:28.842601Z","shell.execute_reply":"2022-12-06T13:57:25.839057Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#We can save and then check the related html page on our local\nsv_t_p_tracking.show_html('sv_t_p_tracking.html')","metadata":{"execution":{"iopub.status.busy":"2022-12-06T13:58:42.230989Z","iopub.execute_input":"2022-12-06T13:58:42.231568Z","iopub.status.idle":"2022-12-06T13:58:42.491780Z","shell.execute_reply.started":"2022-12-06T13:58:42.231525Z","shell.execute_reply":"2022-12-06T13:58:42.490822Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sv_train_baseline_helmets =sv.analyze(train_baseline_helmets)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T14:00:41.177851Z","iopub.execute_input":"2022-12-06T14:00:41.178758Z","iopub.status.idle":"2022-12-06T14:01:35.972951Z","shell.execute_reply.started":"2022-12-06T14:00:41.178711Z","shell.execute_reply":"2022-12-06T14:01:35.971414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sv_train_baseline_helmets.show_html('sv_train_baseline_helmets.html')","metadata":{"execution":{"iopub.status.busy":"2022-12-06T14:01:35.975987Z","iopub.execute_input":"2022-12-06T14:01:35.977318Z","iopub.status.idle":"2022-12-06T14:01:36.032308Z","shell.execute_reply.started":"2022-12-06T14:01:35.977245Z","shell.execute_reply":"2022-12-06T14:01:36.029618Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}