{"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":"### We will Try to perform some EDA using Pandas Profiling.\n\n### Why?\nBecause it's actually informative and is absolutely easy peasy!","metadata":{}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport pandas_profiling as pp\nimport seaborn as sns\nimport warnings\nimport os\n\nwarnings.filterwarnings('ignore')\n%matplotlib inline","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-06-10T20:08:35.062983Z","iopub.execute_input":"2021-06-10T20:08:35.063607Z","iopub.status.idle":"2021-06-10T20:08:37.215568Z","shell.execute_reply.started":"2021-06-10T20:08:35.063513Z","shell.execute_reply":"2021-06-10T20:08:37.214443Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"DATA_DIR = \"../input/mlb-player-digital-engagement-forecasting\"","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:13:31.982644Z","iopub.execute_input":"2021-06-10T20:13:31.983236Z","iopub.status.idle":"2021-06-10T20:13:31.987625Z","shell.execute_reply.started":"2021-06-10T20:13:31.983178Z","shell.execute_reply":"2021-06-10T20:13:31.986364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Choose All CSVs except the Example Ones","metadata":{}},{"cell_type":"code","source":"all_csvs = ['players.csv',\n 'teams.csv',\n 'seasons.csv',\n 'train.csv',\n 'awards.csv']\n\nall_root_csvs = [os.path.join(DATA_DIR,each) for each in all_csvs]","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:13:33.346694Z","iopub.execute_input":"2021-06-10T20:13:33.347086Z","iopub.status.idle":"2021-06-10T20:13:33.351933Z","shell.execute_reply.started":"2021-06-10T20:13:33.347052Z","shell.execute_reply":"2021-06-10T20:13:33.350943Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Players","metadata":{}},{"cell_type":"code","source":"df_pl = pd.read_csv(all_root_csvs[0])","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:14:12.014105Z","iopub.execute_input":"2021-06-10T20:14:12.014675Z","iopub.status.idle":"2021-06-10T20:14:12.074923Z","shell.execute_reply.started":"2021-06-10T20:14:12.014623Z","shell.execute_reply":"2021-06-10T20:14:12.074177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_pl.info()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:14:26.861144Z","iopub.execute_input":"2021-06-10T20:14:26.861763Z","iopub.status.idle":"2021-06-10T20:14:26.885254Z","shell.execute_reply.started":"2021-06-10T20:14:26.861661Z","shell.execute_reply":"2021-06-10T20:14:26.884290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_pl.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:14:36.504835Z","iopub.execute_input":"2021-06-10T20:14:36.505374Z","iopub.status.idle":"2021-06-10T20:14:36.530515Z","shell.execute_reply.started":"2021-06-10T20:14:36.505332Z","shell.execute_reply":"2021-06-10T20:14:36.529120Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pp.ProfileReport(df_pl)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:14:58.900125Z","iopub.execute_input":"2021-06-10T20:14:58.900491Z","iopub.status.idle":"2021-06-10T20:15:11.876823Z","shell.execute_reply.started":"2021-06-10T20:14:58.900461Z","shell.execute_reply":"2021-06-10T20:15:11.875799Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Teams","metadata":{}},{"cell_type":"code","source":"df_t = pd.read_csv(all_root_csvs[1])","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:16:14.178071Z","iopub.execute_input":"2021-06-10T20:16:14.178448Z","iopub.status.idle":"2021-06-10T20:16:14.205802Z","shell.execute_reply.started":"2021-06-10T20:16:14.178417Z","shell.execute_reply":"2021-06-10T20:16:14.204605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_t.info()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:16:31.543299Z","iopub.execute_input":"2021-06-10T20:16:31.543668Z","iopub.status.idle":"2021-06-10T20:16:31.558382Z","shell.execute_reply.started":"2021-06-10T20:16:31.543636Z","shell.execute_reply":"2021-06-10T20:16:31.557435Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_t.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:16:42.255257Z","iopub.execute_input":"2021-06-10T20:16:42.255635Z","iopub.status.idle":"2021-06-10T20:16:42.283639Z","shell.execute_reply.started":"2021-06-10T20:16:42.255600Z","shell.execute_reply":"2021-06-10T20:16:42.282872Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pp.ProfileReport(df_t)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:16:55.066080Z","iopub.execute_input":"2021-06-10T20:16:55.066586Z","iopub.status.idle":"2021-06-10T20:17:04.205289Z","shell.execute_reply.started":"2021-06-10T20:16:55.066555Z","shell.execute_reply":"2021-06-10T20:17:04.204199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Seasons","metadata":{}},{"cell_type":"code","source":"df_s = pd.read_csv(all_root_csvs[2])","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:19:19.070239Z","iopub.execute_input":"2021-06-10T20:19:19.070675Z","iopub.status.idle":"2021-06-10T20:19:19.084005Z","shell.execute_reply.started":"2021-06-10T20:19:19.070644Z","shell.execute_reply":"2021-06-10T20:19:19.082755Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_s.info()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:19:27.391169Z","iopub.execute_input":"2021-06-10T20:19:27.391567Z","iopub.status.idle":"2021-06-10T20:19:27.406974Z","shell.execute_reply.started":"2021-06-10T20:19:27.391534Z","shell.execute_reply":"2021-06-10T20:19:27.405748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_s.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:19:37.457155Z","iopub.execute_input":"2021-06-10T20:19:37.457556Z","iopub.status.idle":"2021-06-10T20:19:37.474690Z","shell.execute_reply.started":"2021-06-10T20:19:37.457525Z","shell.execute_reply":"2021-06-10T20:19:37.473483Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pp.ProfileReport(df_s)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:19:49.871252Z","iopub.execute_input":"2021-06-10T20:19:49.871633Z","iopub.status.idle":"2021-06-10T20:19:56.579721Z","shell.execute_reply.started":"2021-06-10T20:19:49.871603Z","shell.execute_reply":"2021-06-10T20:19:56.578804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Awards","metadata":{}},{"cell_type":"code","source":"df_a = pd.read_csv(all_root_csvs[-1])","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:21:07.616856Z","iopub.execute_input":"2021-06-10T20:21:07.617267Z","iopub.status.idle":"2021-06-10T20:21:07.659574Z","shell.execute_reply.started":"2021-06-10T20:21:07.617237Z","shell.execute_reply":"2021-06-10T20:21:07.658105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_a.info()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:21:18.656267Z","iopub.execute_input":"2021-06-10T20:21:18.656619Z","iopub.status.idle":"2021-06-10T20:21:18.677202Z","shell.execute_reply.started":"2021-06-10T20:21:18.656591Z","shell.execute_reply":"2021-06-10T20:21:18.676145Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_a.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:21:33.937326Z","iopub.execute_input":"2021-06-10T20:21:33.937785Z","iopub.status.idle":"2021-06-10T20:21:33.963650Z","shell.execute_reply.started":"2021-06-10T20:21:33.937746Z","shell.execute_reply":"2021-06-10T20:21:33.962452Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pp.ProfileReport(df_a)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:21:43.566601Z","iopub.execute_input":"2021-06-10T20:21:43.566996Z","iopub.status.idle":"2021-06-10T20:21:49.649197Z","shell.execute_reply.started":"2021-06-10T20:21:43.566962Z","shell.execute_reply":"2021-06-10T20:21:49.648145Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train\n\nI have to admit that the training dataset is quite bulky: around `3GB`. This  is probably optimized using big data tools such as an Apache Spark RDD/ Hadoop. But that's another lesson.\n\nI'm not exactly sure that Pandas Profiling can deal with such big datasets, but who knows?","metadata":{}},{"cell_type":"code","source":"df_train = pd.read_csv(all_root_csvs[-2])","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:22:31.311761Z","iopub.execute_input":"2021-06-10T20:22:31.312109Z","iopub.status.idle":"2021-06-10T20:23:47.682525Z","shell.execute_reply.started":"2021-06-10T20:22:31.312079Z","shell.execute_reply":"2021-06-10T20:23:47.681385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.info()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:23:47.684386Z","iopub.execute_input":"2021-06-10T20:23:47.684673Z","iopub.status.idle":"2021-06-10T20:23:47.703590Z","shell.execute_reply.started":"2021-06-10T20:23:47.684646Z","shell.execute_reply":"2021-06-10T20:23:47.702431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:23:47.705351Z","iopub.execute_input":"2021-06-10T20:23:47.705769Z","iopub.status.idle":"2021-06-10T20:23:47.730820Z","shell.execute_reply.started":"2021-06-10T20:23:47.705696Z","shell.execute_reply":"2021-06-10T20:23:47.729655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# pp.ProfileReport(df_train)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:24:16.514392Z","iopub.execute_input":"2021-06-10T20:24:16.514908Z"},"trusted":true},"execution_count":null,"outputs":[]}]}