{"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"papermill":{"default_parameters":{},"duration":42.399313,"end_time":"2022-09-13T14:09:35.443305","environment_variables":{},"exception":null,"input_path":"__notebook__.ipynb","output_path":"__notebook__.ipynb","parameters":{},"start_time":"2022-09-13T14:08:53.043992","version":"2.3.4"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":30626,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# S4E12 HistPlot","metadata":{"papermill":{"duration":0.004852,"end_time":"2022-09-13T14:09:03.598005","exception":false,"start_time":"2022-09-13T14:09:03.593153","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"/kaggle/input/playground-series-s4e12","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport random\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom tqdm import tqdm\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":2.47983,"end_time":"2022-09-13T14:09:06.081763","exception":false,"start_time":"2022-09-13T14:09:03.601933","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2024-12-01T08:00:27.95413Z","iopub.execute_input":"2024-12-01T08:00:27.95476Z","iopub.status.idle":"2024-12-01T08:00:27.959366Z","shell.execute_reply.started":"2024-12-01T08:00:27.954731Z","shell.execute_reply":"2024-12-01T08:00:27.958279Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train0=pd.read_csv('/kaggle/input/playground-series-s4e12/train.csv')\ntest0=pd.read_csv('/kaggle/input/playground-series-s4e12/test.csv')","metadata":{"papermill":{"duration":0.170345,"end_time":"2022-09-13T14:09:06.256061","exception":false,"start_time":"2022-09-13T14:09:06.085716","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2024-12-01T08:00:27.961115Z","iopub.execute_input":"2024-12-01T08:00:27.961428Z","iopub.status.idle":"2024-12-01T08:00:33.787993Z","shell.execute_reply.started":"2024-12-01T08:00:27.961399Z","shell.execute_reply":"2024-12-01T08:00:33.787069Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"display(train0.info())\nprint()\ndisplay(test0.info())","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"N=list(range(len(train0)))\nrandom.shuffle(N)\ntrain=train0.iloc[N[0:10000]].reset_index(drop=True)\n\nM=list(range(len(test0)))\nrandom.shuffle(M)\ntest=test0.iloc[M[0:10000]].reset_index(drop=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-01T08:00:33.789175Z","iopub.execute_input":"2024-12-01T08:00:33.789493Z","iopub.status.idle":"2024-12-01T08:00:34.979176Z","shell.execute_reply.started":"2024-12-01T08:00:33.789465Z","shell.execute_reply":"2024-12-01T08:00:34.978196Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"display(train[0:3])\n#display(train.info())","metadata":{"papermill":{"duration":0.035518,"end_time":"2022-09-13T14:09:06.295235","exception":false,"start_time":"2022-09-13T14:09:06.259717","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-12-01T08:00:34.980364Z","iopub.execute_input":"2024-12-01T08:00:34.980666Z","iopub.status.idle":"2024-12-01T08:00:35.068127Z","shell.execute_reply.started":"2024-12-01T08:00:34.980642Z","shell.execute_reply":"2024-12-01T08:00:35.06731Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cols=train.columns.tolist()\nprint(cols)\nprint(len(cols))","metadata":{"papermill":{"duration":0.016405,"end_time":"2022-09-13T14:09:06.315603","exception":false,"start_time":"2022-09-13T14:09:06.299198","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-12-01T08:00:35.070543Z","iopub.execute_input":"2024-12-01T08:00:35.070869Z","iopub.status.idle":"2024-12-01T08:00:35.075602Z","shell.execute_reply.started":"2024-12-01T08:00:35.070844Z","shell.execute_reply":"2024-12-01T08:00:35.074726Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"tcols=test.columns.tolist()\nprint(tcols)\nprint(len(tcols))","metadata":{"execution":{"iopub.status.busy":"2024-12-01T08:00:35.076697Z","iopub.execute_input":"2024-12-01T08:00:35.076952Z","iopub.status.idle":"2024-12-01T08:00:35.083846Z","shell.execute_reply.started":"2024-12-01T08:00:35.076931Z","shell.execute_reply":"2024-12-01T08:00:35.083038Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig, ax = plt.subplots(11,2,figsize=(12,40))\nplt.subplots_adjust(hspace=0.8)\n\nfor i in tqdm(range(len(cols))):\n    r=i//2\n    c=i%2\n    try:\n        if i!=20:\n            sns.histplot(train[cols[i]], label='train '+cols[i], ax=ax[r,c], color='C1',bins=40, alpha=0.8)\n            sns.histplot(test[cols[i]], label='test '+cols[i], ax=ax[r,c], color='C2',bins=40, alpha=0.4)\n        else:\n            sns.histplot(train[cols[i]], label='train '+cols[i], ax=ax[r,c], color='C1',bins=40, alpha=0.8)\n    \n        ax[r,c].legend()\n        ax[r,c].grid()\n        ax[r,c].tick_params(axis='x', labelrotation=80)\n        \n    except:\n        continue\n\nplt.show()","metadata":{"papermill":{"duration":0.016812,"end_time":"2022-09-13T14:09:34.604792","exception":false,"start_time":"2022-09-13T14:09:34.58798","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-12-01T08:00:35.084912Z","iopub.execute_input":"2024-12-01T08:00:35.085175Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}