{"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":"!pip install watermark\n!pip install nicaviz","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2021-09-29T22:22:01.295368Z","iopub.execute_input":"2021-09-29T22:22:01.295935Z","iopub.status.idle":"2021-09-29T22:22:20.170202Z","shell.execute_reply.started":"2021-09-29T22:22:01.295827Z","shell.execute_reply":"2021-09-29T22:22:20.168965Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%reload_ext autoreload\n%autoreload 2","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:23:44.575458Z","iopub.execute_input":"2021-09-29T22:23:44.575734Z","iopub.status.idle":"2021-09-29T22:23:44.624144Z","shell.execute_reply.started":"2021-09-29T22:23:44.575701Z","shell.execute_reply":"2021-09-29T22:23:44.623262Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 10px; background: #001f3f;\"><b style=\"color:#DEB887;\">Nicaviz by Nick Brooks, aka: Nicapotato</b></h1></center>","metadata":{}},{"cell_type":"markdown","source":"#Code by Nicapotato https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\nhttps://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nVentilator Pressure Prediction Nicaviz EDA\nBy Nick Brooks, September 2021\n\nResources:\n\nhttps://github.com/nicapotato/nicaviz\n\n\nhttps://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb","metadata":{}},{"cell_type":"markdown","source":"![](https://avatars.githubusercontent.com/u/14944829?v=4)https://github.com/nicapotato","metadata":{}},{"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\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport nicaviz\nimport seaborn as sns\nimport time\nimport matplotlib.pyplot as plt\nimport itertools\nimport glob\nimport re\nimport math\n\nsns.set_style(\"whitegrid\")\n\n%load_ext watermark\n%watermark \n\nimport warnings\nwarnings.filterwarnings(\"ignore\", category=DeprecationWarning) \nwarnings.simplefilter(action='ignore', category=FutureWarning)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\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# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\n\nnotebookstart = time.time()\n%watermark --iversions","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2021-09-29T22:23:50.634068Z","iopub.execute_input":"2021-09-29T22:23:50.634351Z","iopub.status.idle":"2021-09-29T22:23:51.809981Z","shell.execute_reply.started":"2021-09-29T22:23:50.634323Z","shell.execute_reply":"2021-09-29T22:23:51.808928Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\n#Tracking 2020\n\ntrack20 = pd.read_csv(\"/kaggle/input/nfl-big-data-bowl-2022/tracking2020.csv\")\n\n\ndisplay(track20.head())\ndisplay(track20.nica.categorical_describe())","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2021-09-29T22:23:57.896741Z","iopub.execute_input":"2021-09-29T22:23:57.897067Z","iopub.status.idle":"2021-09-29T22:25:09.831835Z","shell.execute_reply.started":"2021-09-29T22:23:57.897032Z","shell.execute_reply":"2021-09-29T22:25:09.830708Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"players = pd.read_csv('../input/nfl-big-data-bowl-2022/players.csv')\nplayers.head()","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:25:42.909544Z","iopub.execute_input":"2021-09-29T22:25:42.911229Z","iopub.status.idle":"2021-09-29T22:25:43.003838Z","shell.execute_reply.started":"2021-09-29T22:25:42.911139Z","shell.execute_reply":"2021-09-29T22:25:43.003156Z"},"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":"2021-09-29T22:25:47.968799Z","iopub.execute_input":"2021-09-29T22:25:47.969432Z","iopub.status.idle":"2021-09-29T22:25:48.029725Z","shell.execute_reply.started":"2021-09-29T22:25:47.969386Z","shell.execute_reply":"2021-09-29T22:25:48.028504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games.dtypes","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:37:54.393127Z","iopub.execute_input":"2021-09-29T23:37:54.393490Z","iopub.status.idle":"2021-09-29T23:37:54.436288Z","shell.execute_reply.started":"2021-09-29T23:37:54.393455Z","shell.execute_reply":"2021-09-29T23:37:54.435221Z"},"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h1><span class=\"label label-default\" style=\"background-color:black;border-radius:100px 100px; font-weight: bold; font-family:Garamond; font-size:20px; color:#03e8fc; padding:10px\">Time Series</span></h1><br>","metadata":{}},{"cell_type":"code","source":"players['birthDate'] = pd.to_datetime(players['birthDate'])","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:25:55.639412Z","iopub.execute_input":"2021-09-29T22:25:55.639701Z","iopub.status.idle":"2021-09-29T22:25:55.688301Z","shell.execute_reply.started":"2021-09-29T22:25:55.639674Z","shell.execute_reply":"2021-09-29T22:25:55.687257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games['gameDate'] = pd.to_datetime(games['gameDate'])","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:27:01.979323Z","iopub.execute_input":"2021-09-29T22:27:01.979650Z","iopub.status.idle":"2021-09-29T22:27:02.025856Z","shell.execute_reply.started":"2021-09-29T22:27:01.979620Z","shell.execute_reply":"2021-09-29T22:27:02.024431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1day (Players file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    players.nica.mass_plot(\n        plt_set= [\"birthDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1D\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:27:08.445921Z","iopub.execute_input":"2021-09-29T22:27:08.446245Z","iopub.status.idle":"2021-09-29T22:27:09.629309Z","shell.execute_reply.started":"2021-09-29T22:27:08.446215Z","shell.execute_reply":"2021-09-29T22:27:09.628068Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1 Week. (Players file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    players.nica.mass_plot(\n        plt_set= [\"birthDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1W\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:27:17.705429Z","iopub.execute_input":"2021-09-29T22:27:17.705750Z","iopub.status.idle":"2021-09-29T22:27:18.588567Z","shell.execute_reply.started":"2021-09-29T22:27:17.705718Z","shell.execute_reply":"2021-09-29T22:27:18.587621Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1 year (Players file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    players.nica.mass_plot(\n        plt_set= [\"birthDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1Y\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:31:29.197161Z","iopub.execute_input":"2021-09-29T22:31:29.197508Z","iopub.status.idle":"2021-09-29T22:31:30.016675Z","shell.execute_reply.started":"2021-09-29T22:31:29.197476Z","shell.execute_reply":"2021-09-29T22:31:30.015678Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1day (Games file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    games.nica.mass_plot(\n        plt_set= [\"gameDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1D\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:29:03.049989Z","iopub.execute_input":"2021-09-29T22:29:03.050610Z","iopub.status.idle":"2021-09-29T22:29:03.940949Z","shell.execute_reply.started":"2021-09-29T22:29:03.050558Z","shell.execute_reply":"2021-09-29T22:29:03.940011Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1Week (Games file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    games.nica.mass_plot(\n        plt_set= [\"gameDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1W\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:33:50.292044Z","iopub.execute_input":"2021-09-29T22:33:50.292748Z","iopub.status.idle":"2021-09-29T22:33:51.108310Z","shell.execute_reply.started":"2021-09-29T22:33:50.292670Z","shell.execute_reply":"2021-09-29T22:33:51.107175Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Interval 1year (Games file)","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Timeserie Resample Plot\"):\n    games.nica.mass_plot(\n        plt_set= [\"gameDate\"],\n        plottype = \"ts_resample\",\n        resample=True,\n        resample_interval=\"1Y\"\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:30:59.753239Z","iopub.execute_input":"2021-09-29T22:30:59.753608Z","iopub.status.idle":"2021-09-29T22:31:00.264243Z","shell.execute_reply.started":"2021-09-29T22:30:59.753573Z","shell.execute_reply":"2021-09-29T22:31:00.262887Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"playersInt = ['nflId', 'weight']","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:36:35.370523Z","iopub.execute_input":"2021-09-29T22:36:35.370895Z","iopub.status.idle":"2021-09-29T22:36:35.410523Z","shell.execute_reply.started":"2021-09-29T22:36:35.370862Z","shell.execute_reply":"2021-09-29T22:36:35.409264Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\n#Sample was reduced to 500. In the Original code was 500000\n\nwith nicaviz.timer(\"Timeserie Rolling Plot\"):\n    players.sample(500).nica.mass_plot(\n        plt_set= playersInt,\n        plottype = \"ts_rolling\",\n        x_var=\"birthDate\",\n        rolling=True,\n        r=30\n    )","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:36:44.797883Z","iopub.execute_input":"2021-09-29T22:36:44.798291Z","iopub.status.idle":"2021-09-29T22:36:45.751541Z","shell.execute_reply.started":"2021-09-29T22:36:44.798244Z","shell.execute_reply":"2021-09-29T22:36:45.750571Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h1><span class=\"label label-default\" style=\"background-color:black;border-radius:100px 100px; font-weight: bold; font-family:Garamond; font-size:20px; color:#03e8fc; padding:10px\">Categorical Variables</span></h1><br>","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\nwith nicaviz.timer(\"Boxplots\"):\n    players.nica.mass_plot(\n        plt_set= playersInt,\n        plottype = \"boxplot\")","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:38:52.087708Z","iopub.execute_input":"2021-09-29T22:38:52.088906Z","iopub.status.idle":"2021-09-29T22:38:52.647535Z","shell.execute_reply.started":"2021-09-29T22:38:52.088866Z","shell.execute_reply":"2021-09-29T22:38:52.646374Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Save the chart below for the next Dataset","metadata":{}},{"cell_type":"code","source":"#Saved for the next Dataset since it was crammed. Too many values.\n\n#Code by Nicapotato https://www.kaggle.com/nicapotato/covid-digital-learning-data-exploration\n\n#categoricals = [\n #   \"collegeName\",\n  #  \"displayName\",\n   # \"Position\",\n    #\"height\",\n    \n#]\n\n#with nicaviz.timer(\"Small Hue Boxplots\"):\n #   for hue_col in categoricals:\n  #      players.nica.mass_plot(\n           # plt_set= playersInt,\n           # hue = hue_col,\n            #columns = 2,\n            #plottype = \"boxplot\")","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:39:00.834519Z","iopub.execute_input":"2021-09-29T22:39:00.834834Z","iopub.status.idle":"2021-09-29T22:39:00.873606Z","shell.execute_reply.started":"2021-09-29T22:39:00.834802Z","shell.execute_reply":"2021-09-29T22:39:00.872592Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#WordCloud","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Wordcloud Plot\"):\n    track20.nica.mass_plot(\n        plt_set= [\"team\", \"playDirection\"],\n        plottype = \"wordcloud\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:40:21.640869Z","iopub.execute_input":"2021-09-29T22:40:21.641259Z","iopub.status.idle":"2021-09-29T22:42:36.967711Z","shell.execute_reply.started":"2021-09-29T22:40:21.641218Z","shell.execute_reply":"2021-09-29T22:42:36.966620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Count Plot\"):\n    track20.nica.mass_plot(\n        plt_set= [\"gameId\", \"playId\"],\n        plottype = \"countplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:39:57.706329Z","iopub.execute_input":"2021-09-29T22:39:57.706686Z","iopub.status.idle":"2021-09-29T22:39:59.549275Z","shell.execute_reply.started":"2021-09-29T22:39:57.706646Z","shell.execute_reply":"2021-09-29T22:39:59.548378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Bar Plot\"):\n    track20.nica.mass_plot(\n        plt_set= [\"x\", \"y\"],\n        x_var = \"team\",\n        plottype = \"bar\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:42:58.179220Z","iopub.execute_input":"2021-09-29T22:42:58.179510Z","iopub.status.idle":"2021-09-29T22:52:09.918614Z","shell.execute_reply.started":"2021-09-29T22:42:58.179482Z","shell.execute_reply":"2021-09-29T22:52:09.917381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Boxplots\"):\n    track20.nica.mass_plot(\n        plt_set= [\"x\", \"y\"],\n        plottype = \"boxplot\")\n\n    track20.nica.mass_plot(\n        plt_set= [\"x\", \"y\"],\n        hue = \"team\",\n        plottype = \"boxplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:52:38.355485Z","iopub.execute_input":"2021-09-29T22:52:38.355775Z","iopub.status.idle":"2021-09-29T22:53:02.599291Z","shell.execute_reply.started":"2021-09-29T22:52:38.355747Z","shell.execute_reply":"2021-09-29T22:53:02.598520Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Distplots\"):\n    track20.nica.mass_plot(\n        plt_set= [\"x\", \"y\"],\n        plottype = \"distplot\")\n\n    track20.nica.mass_plot(\n        plt_set= [\"x\", \"y\"],\n        hue = \"team\",\n        plottype = \"distplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:53:24.293388Z","iopub.execute_input":"2021-09-29T22:53:24.293727Z","iopub.status.idle":"2021-09-29T22:58:16.309129Z","shell.execute_reply.started":"2021-09-29T22:53:24.293692Z","shell.execute_reply":"2021-09-29T22:58:16.308234Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Distplots\"):\n    track20.nica.mass_plot(\n        plt_set= [\"s\", \"a\"],\n        hue = \"frameId\",\n        plottype = \"distplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:58:41.055705Z","iopub.execute_input":"2021-09-29T22:58:41.056149Z","iopub.status.idle":"2021-09-29T22:59:04.071671Z","shell.execute_reply.started":"2021-09-29T22:58:41.056085Z","shell.execute_reply":"2021-09-29T22:59:04.070615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\nwith nicaviz.timer(\"Countplot\"):\n    track20.nica.mass_plot(\n        plt_set= [\"gameId\", \"playId\"],\n        hue = \"playDirection\",\n        plottype = \"countplot\")\n\n    track20.nica.mass_plot(\n        plt_set= [\"gameId\", \"playId\"],\n        plottype = \"countplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T22:59:30.347745Z","iopub.execute_input":"2021-09-29T22:59:30.348076Z","iopub.status.idle":"2021-09-29T22:59:43.177605Z","shell.execute_reply.started":"2021-09-29T22:59:30.348044Z","shell.execute_reply":"2021-09-29T22:59:43.176452Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\ncategoricals = [\"event\", \"displayName\", \"position\", \"team\", \"playDirection\"]\n#continuous = ['x', 'y', \"s\", \"a\", \"dis\", \"o\", \"dir\", \"nflId\", \"jerseyNumber\"] #I reduced since it took many time\ncontinuous = [\"dir\", \"nflId\", \"jerseyNumber\"]#Test below with only 3 continuous\ninteger = ['frameId', 'gameId', 'playId']\ntimevar = 'time'","metadata":{"execution":{"iopub.status.busy":"2021-09-29T22:59:53.870127Z","iopub.execute_input":"2021-09-29T22:59:53.870757Z","iopub.status.idle":"2021-09-29T22:59:53.908907Z","shell.execute_reply.started":"2021-09-29T22:59:53.870718Z","shell.execute_reply":"2021-09-29T22:59:53.907337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with nicaviz.timer(\"Distplots\"):\n    track20.nica.mass_plot(\n        plt_set= [\"nflId\", \"jerseyNumber\"],\n        plottype = \"distplot\")\n\n    track20.nica.mass_plot(\n        plt_set= [\"nflId\", \"jerseyNumber\"],\n        hue = \"displayName\",\n        plottype = \"distplot\")","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:00:14.659120Z","iopub.execute_input":"2021-09-29T23:00:14.659432Z","iopub.status.idle":"2021-09-29T23:03:07.998851Z","shell.execute_reply.started":"2021-09-29T23:00:14.659401Z","shell.execute_reply":"2021-09-29T23:03:07.997438Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\ntrack20.nica.mass_plot(\n    plt_set = categoricals,\n    columns = 3,\n    plottype = \"countplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T23:03:33.563640Z","iopub.execute_input":"2021-09-29T23:03:33.563988Z","iopub.status.idle":"2021-09-29T23:04:37.422338Z","shell.execute_reply.started":"2021-09-29T23:03:33.563955Z","shell.execute_reply":"2021-09-29T23:04:37.421369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\n#It took 3 minutes to plot the reduced continuous features\n\ntrack20.nica.mass_plot(\n    plt_set = continuous,\n    columns = 3,\n    plottype = \"distplot\")\n\nprint(\"['nflId', 'jerseyNumber'] Correlation: {}\".format(track20[['nflId', 'jerseyNumber']].corr().iloc[0,1]))","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T23:12:39.295303Z","iopub.execute_input":"2021-09-29T23:12:39.295834Z","iopub.status.idle":"2021-09-29T23:15:54.295137Z","shell.execute_reply.started":"2021-09-29T23:12:39.295800Z","shell.execute_reply":"2021-09-29T23:15:54.294135Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Recommended by Nick using column = 1 for pivot plots if they get crammed.","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\nfor cont in continuous:\n    track20.nica.pivot_plots(\n        categoricalcols = categoricals,\n        valuecol = cont,\n        aggfunc = np.mean,\n        columns = 1)","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:16:15.825106Z","iopub.execute_input":"2021-09-29T23:16:15.825398Z","iopub.status.idle":"2021-09-29T23:19:41.890758Z","shell.execute_reply.started":"2021-09-29T23:16:15.825370Z","shell.execute_reply":"2021-09-29T23:19:41.889920Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#To satisfy Nick curiousity about how the continuous variables differ with Team category.","metadata":{}},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\ntrack20.nica.mass_plot(\n    plt_set = continuous,\n    columns = 3,\n    hue = 'team',\n    plottype = \"distplot\");","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T23:20:38.069057Z","iopub.execute_input":"2021-09-29T23:20:38.070149Z","iopub.status.idle":"2021-09-29T23:24:17.329928Z","shell.execute_reply.started":"2021-09-29T23:20:38.070082Z","shell.execute_reply":"2021-09-29T23:24:17.328911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\ntrack20.nica.mass_plot(\n    plt_set = [\"event\", \"displayName\", \"position\", \"playDirection\"],\n    columns = 3,\n    hue = 'team',\n    plottype = \"countplot\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-09-29T23:24:33.396514Z","iopub.execute_input":"2021-09-29T23:24:33.396812Z","iopub.status.idle":"2021-09-29T23:26:04.629256Z","shell.execute_reply.started":"2021-09-29T23:24:33.396783Z","shell.execute_reply":"2021-09-29T23:26:04.628243Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with nicaviz.timer(\"Correlation Plot\"):\n    games.nica.rank_correlations_plots([\"season\", \"gameId\", \"week\"], 9)","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:33:22.465416Z","iopub.execute_input":"2021-09-29T23:33:22.465784Z","iopub.status.idle":"2021-09-29T23:33:24.287934Z","shell.execute_reply.started":"2021-09-29T23:33:22.465744Z","shell.execute_reply":"2021-09-29T23:33:24.286899Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with nicaviz.timer(\"Pivot Heatmap Plot\"):\n    categorical = ['homeTeamAbbr', 'visitorTeamAbbr', 'gameTimeEastern']\n    games.nica.pivot_plots(categorical, \"gameId\", np.sum)","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:40:36.717253Z","iopub.execute_input":"2021-09-29T23:40:36.717611Z","iopub.status.idle":"2021-09-29T23:40:39.078953Z","shell.execute_reply.started":"2021-09-29T23:40:36.717575Z","shell.execute_reply":"2021-09-29T23:40:39.077886Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Nick Brooks https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\nfor cont in continuous:\n    track20.nica.pivot_plots(categoricals, cont, np.mean)","metadata":{"execution":{"iopub.status.busy":"2021-09-29T23:27:40.606941Z","iopub.execute_input":"2021-09-29T23:27:40.607329Z","iopub.status.idle":"2021-09-29T23:31:16.051693Z","shell.execute_reply.started":"2021-09-29T23:27:40.607298Z","shell.execute_reply":"2021-09-29T23:31:16.050666Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Notebook Runtime: %0.2f Minutes\"%((time.time() - notebookstart)/60))","metadata":{"execution":{"iopub.status.busy":"2021-09-30T00:37:12.126305Z","iopub.execute_input":"2021-09-30T00:37:12.126750Z","iopub.status.idle":"2021-09-30T00:37:12.213057Z","shell.execute_reply.started":"2021-09-30T00:37:12.126670Z","shell.execute_reply":"2021-09-30T00:37:12.212043Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#That's so cool Nick Brooks (a.k.a Nicapotato). Thank you.\n\n#Acknowledgement\n\nCode by Nicapotato https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook\n\nVentilator Pressure Prediction Nicaviz EDA By Nick Brooks, September 2021\n\nResources\n\nhttps://github.com/nicapotato/nicaviz https://github.com/nicapotato/nicaviz/blob/master/notebooks/Plot_Examples.ipynb\n\n#Vote Nicapotato code https://www.kaggle.com/nicapotato/ventilator-pressure-prediction-nicaviz-eda/notebook","metadata":{}}]}