{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":102335,"databundleVersionId":12518947,"sourceType":"competition"}],"dockerImageVersionId":31089,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd \nimport numpy as np \nimport matplotlib.pyplot as plt ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:18:56.117224Z","iopub.execute_input":"2025-08-16T06:18:56.117785Z","iopub.status.idle":"2025-08-16T06:18:56.121305Z","shell.execute_reply.started":"2025-08-16T06:18:56.117760Z","shell.execute_reply":"2025-08-16T06:18:56.120606Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo = pd.read_csv('/kaggle/input/cmi-detect-behavior-with-sensor-data/train_demographics.csv')\ndf_demo.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:18:59.442855Z","iopub.execute_input":"2025-08-16T06:18:59.443164Z","iopub.status.idle":"2025-08-16T06:18:59.456143Z","shell.execute_reply.started":"2025-08-16T06:18:59.443140Z","shell.execute_reply":"2025-08-16T06:18:59.455448Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:19:03.153493Z","iopub.execute_input":"2025-08-16T06:19:03.153796Z","iopub.status.idle":"2025-08-16T06:19:03.159640Z","shell.execute_reply.started":"2025-08-16T06:19:03.153775Z","shell.execute_reply":"2025-08-16T06:19:03.158578Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.describe()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:19:31.253222Z","iopub.execute_input":"2025-08-16T06:19:31.253508Z","iopub.status.idle":"2025-08-16T06:19:31.278741Z","shell.execute_reply.started":"2025-08-16T06:19:31.253486Z","shell.execute_reply":"2025-08-16T06:19:31.277940Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.dtypes","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:19:55.080496Z","iopub.execute_input":"2025-08-16T06:19:55.081247Z","iopub.status.idle":"2025-08-16T06:19:55.087446Z","shell.execute_reply.started":"2025-08-16T06:19:55.081219Z","shell.execute_reply":"2025-08-16T06:19:55.086654Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.columns","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:37:31.782019Z","iopub.execute_input":"2025-08-15T07:37:31.782928Z","iopub.status.idle":"2025-08-15T07:37:31.789057Z","shell.execute_reply.started":"2025-08-15T07:37:31.782886Z","shell.execute_reply":"2025-08-15T07:37:31.788148Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:37:33.882218Z","iopub.execute_input":"2025-08-15T07:37:33.882537Z","iopub.status.idle":"2025-08-15T07:37:33.892269Z","shell.execute_reply.started":"2025-08-15T07:37:33.882511Z","shell.execute_reply":"2025-08-15T07:37:33.891361Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo[['adult_child' , 'sex' , 'handedness']] = df_demo[['adult_child' , 'sex' , 'handedness']].astype('object')\n#df_demo[['shoulder_to_wrist_cm']] = df_demo[['shoulder_to_wrist_cm']].astype('float64')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:20:19.022251Z","iopub.execute_input":"2025-08-16T06:20:19.023073Z","iopub.status.idle":"2025-08-16T06:20:19.029191Z","shell.execute_reply.started":"2025-08-16T06:20:19.023045Z","shell.execute_reply":"2025-08-16T06:20:19.028270Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:20:22.651128Z","iopub.execute_input":"2025-08-16T06:20:22.651403Z","iopub.status.idle":"2025-08-16T06:20:22.661916Z","shell.execute_reply.started":"2025-08-16T06:20:22.651384Z","shell.execute_reply":"2025-08-16T06:20:22.661054Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.isna().sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:18:27.447273Z","iopub.execute_input":"2025-08-16T06:18:27.447533Z","iopub.status.idle":"2025-08-16T06:18:27.454774Z","shell.execute_reply.started":"2025-08-16T06:18:27.447514Z","shell.execute_reply":"2025-08-16T06:18:27.453904Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.describe()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-16T06:20:31.366282Z","iopub.execute_input":"2025-08-16T06:20:31.366538Z","iopub.status.idle":"2025-08-16T06:20:31.386862Z","shell.execute_reply.started":"2025-08-16T06:20:31.366521Z","shell.execute_reply":"2025-08-16T06:20:31.385887Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:37:54.334334Z","iopub.execute_input":"2025-08-15T07:37:54.335059Z","iopub.status.idle":"2025-08-15T07:37:54.346726Z","shell.execute_reply.started":"2025-08-15T07:37:54.335032Z","shell.execute_reply":"2025-08-15T07:37:54.345773Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo= pd.get_dummies(df_demo , columns = ['adult_child' , 'sex' , 'handedness'] , dtype=np.float64 , drop_first=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:37:59.481861Z","iopub.execute_input":"2025-08-15T07:37:59.482158Z","iopub.status.idle":"2025-08-15T07:37:59.491409Z","shell.execute_reply.started":"2025-08-15T07:37:59.482133Z","shell.execute_reply":"2025-08-15T07:37:59.490520Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:38:01.413098Z","iopub.execute_input":"2025-08-15T07:38:01.413391Z","iopub.status.idle":"2025-08-15T07:38:01.426071Z","shell.execute_reply.started":"2025-08-15T07:38:01.413366Z","shell.execute_reply":"2025-08-15T07:38:01.425319Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.rename(columns={'sex_1': 'sex_male' , 'adult_child_1': 'adult_child' , 'handedness_1': 'handedness_right'} , inplace = True)\ndf_demo","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:38:05.981579Z","iopub.execute_input":"2025-08-15T07:38:05.981877Z","iopub.status.idle":"2025-08-15T07:38:05.997930Z","shell.execute_reply.started":"2025-08-15T07:38:05.981854Z","shell.execute_reply":"2025-08-15T07:38:05.997092Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:38:19.290359Z","iopub.execute_input":"2025-08-15T07:38:19.290675Z","iopub.status.idle":"2025-08-15T07:38:19.300018Z","shell.execute_reply.started":"2025-08-15T07:38:19.290652Z","shell.execute_reply":"2025-08-15T07:38:19.299047Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Exploratory Data analysis** ","metadata":{}},{"cell_type":"markdown","source":"**Single Variable Analysis**","metadata":{}},{"cell_type":"code","source":"df_demo.mean(numeric_only=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:50:03.075399Z","iopub.execute_input":"2025-08-15T07:50:03.075722Z","iopub.status.idle":"2025-08-15T07:50:03.083555Z","shell.execute_reply.started":"2025-08-15T07:50:03.075700Z","shell.execute_reply":"2025-08-15T07:50:03.082728Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_demo.select_dtypes(include=['number']).median()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:45:39.623365Z","iopub.execute_input":"2025-08-15T07:45:39.624122Z","iopub.status.idle":"2025-08-15T07:45:39.631575Z","shell.execute_reply.started":"2025-08-15T07:45:39.624095Z","shell.execute_reply":"2025-08-15T07:45:39.630801Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Plots**","metadata":{}},{"cell_type":"code","source":"fig , axes = plt.subplots(3 , 3 , figsize = (12,12))\naxes_flat = axes.flatten()\n\nfor i , col in enumerate(df_demo.columns[1:]):\n    ax = axes_flat[i]\n    ax.hist(df_demo[col])\n    ax.set_title(col)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:58:45.604571Z","iopub.execute_input":"2025-08-15T07:58:45.605184Z","iopub.status.idle":"2025-08-15T07:58:46.964044Z","shell.execute_reply.started":"2025-08-15T07:58:45.605156Z","shell.execute_reply":"2025-08-15T07:58:46.963221Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig , axes = plt.subplots(2 , 3 , figsize = (12,12))\naxes_flat = axes.flatten() \n\nfor i , col in enumerate(df_demo.select_dtypes('float64')):\n    ax = axes_flat[i]\n    ax.boxplot(df_demo[col])\n    ax.set_title(col)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-08-15T07:57:00.016818Z","iopub.execute_input":"2025-08-15T07:57:00.017093Z","iopub.status.idle":"2025-08-15T07:57:00.869344Z","shell.execute_reply.started":"2025-08-15T07:57:00.017073Z","shell.execute_reply":"2025-08-15T07:57:00.868310Z"}},"outputs":[],"execution_count":null}]}