{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":81933,"databundleVersionId":9643020,"sourceType":"competition"}],"dockerImageVersionId":30775,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# Importing essential libraries\nimport pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport plotly.express as px","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:37:08.616841Z","iopub.execute_input":"2024-09-28T18:37:08.617313Z","iopub.status.idle":"2024-09-28T18:37:08.623646Z","shell.execute_reply.started":"2024-09-28T18:37:08.617269Z","shell.execute_reply":"2024-09-28T18:37:08.622220Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Loading data\ndf_train = pd.read_csv('/kaggle/input/child-mind-institute-problematic-internet-use/train.csv')\ndf_test = pd.read_csv('/kaggle/input/child-mind-institute-problematic-internet-use/test.csv')","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:37:11.010873Z","iopub.execute_input":"2024-09-28T18:37:11.011311Z","iopub.status.idle":"2024-09-28T18:37:11.103468Z","shell.execute_reply.started":"2024-09-28T18:37:11.011270Z","shell.execute_reply":"2024-09-28T18:37:11.102177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Aperçu rapide des données\ndf_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:37:14.604168Z","iopub.execute_input":"2024-09-28T18:37:14.604646Z","iopub.status.idle":"2024-09-28T18:37:14.641921Z","shell.execute_reply.started":"2024-09-28T18:37:14.604599Z","shell.execute_reply":"2024-09-28T18:37:14.640489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test.head()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:27:46.030431Z","iopub.execute_input":"2024-09-28T17:27:46.030898Z","iopub.status.idle":"2024-09-28T17:27:46.064761Z","shell.execute_reply.started":"2024-09-28T17:27:46.030853Z","shell.execute_reply":"2024-09-28T17:27:46.063432Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.info()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:29:20.374119Z","iopub.execute_input":"2024-09-28T17:29:20.374997Z","iopub.status.idle":"2024-09-28T17:29:20.401313Z","shell.execute_reply.started":"2024-09-28T17:29:20.374949Z","shell.execute_reply":"2024-09-28T17:29:20.400199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:29:53.461787Z","iopub.execute_input":"2024-09-28T17:29:53.462340Z","iopub.status.idle":"2024-09-28T17:29:53.479420Z","shell.execute_reply.started":"2024-09-28T17:29:53.462285Z","shell.execute_reply":"2024-09-28T17:29:53.478129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Descriptive statistics of training data\ndf_train.describe()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:35:20.937055Z","iopub.execute_input":"2024-09-28T17:35:20.937520Z","iopub.status.idle":"2024-09-28T17:35:21.120130Z","shell.execute_reply.started":"2024-09-28T17:35:20.937464Z","shell.execute_reply":"2024-09-28T17:35:21.118846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Visualization of missing data\nplt.figure(figsize=(12, 8))\nsns.heatmap(df_train.isnull(), cbar=False, cmap='viridis', yticklabels=False)\nplt.title('Visualizing Missing Values ​​in df_train')\nplt.show()\n\n# Pourcentage de valeurs manquantes par colonne\nmissing_values = df_train.isnull().mean() * 100\nprint(missing_values[missing_values > 0].sort_values(ascending=False))\n","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:36:32.479247Z","iopub.execute_input":"2024-09-28T17:36:32.479715Z","iopub.status.idle":"2024-09-28T17:36:33.414515Z","shell.execute_reply.started":"2024-09-28T17:36:32.479669Z","shell.execute_reply":"2024-09-28T17:36:33.413317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:27:52.204950Z","iopub.execute_input":"2024-09-28T17:27:52.205389Z","iopub.status.idle":"2024-09-28T17:27:52.251840Z","shell.execute_reply.started":"2024-09-28T17:27:52.205344Z","shell.execute_reply":"2024-09-28T17:27:52.250680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Visualization of numeric variables\nnumeric_columns = df_train.select_dtypes(include=['float64', 'int64']).columns\ndf_train[numeric_columns].hist(bins=30, figsize=(18, 12), color='blue', edgecolor='black')\nplt.suptitle('Distribution of Numerical Variables', fontsize=16)\nplt.tight_layout()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:33:12.037988Z","iopub.execute_input":"2024-09-28T17:33:12.038445Z","iopub.status.idle":"2024-09-28T17:33:26.549018Z","shell.execute_reply.started":"2024-09-28T17:33:12.038401Z","shell.execute_reply":"2024-09-28T17:33:26.547725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Boxplot to see the relationship between age and target 'sii'\nplt.figure(figsize=(8, 6))\nsns.boxplot(x='sii', y='Basic_Demos-Age', data=df_train)  # Remplacer 'Age' par d'autres variables numériques si nécessaire\nplt.title('Age Distribution Relative to Target sii')\nplt.show()\n","metadata":{"execution":{"iopub.status.busy":"2024-09-28T17:32:36.487432Z","iopub.execute_input":"2024-09-28T17:32:36.487920Z","iopub.status.idle":"2024-09-28T17:32:36.754122Z","shell.execute_reply.started":"2024-09-28T17:32:36.487862Z","shell.execute_reply":"2024-09-28T17:32:36.752901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Check data types in df_train\nprint(df_train.dtypes)","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:43:58.349197Z","iopub.execute_input":"2024-09-28T18:43:58.349660Z","iopub.status.idle":"2024-09-28T18:43:58.359164Z","shell.execute_reply.started":"2024-09-28T18:43:58.349615Z","shell.execute_reply":"2024-09-28T18:43:58.357381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Select only numeric columns for correlation matrix\nnumeric_columns = df_train.select_dtypes(include=[np.number])","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:44:13.297721Z","iopub.execute_input":"2024-09-28T18:44:13.298205Z","iopub.status.idle":"2024-09-28T18:44:13.306126Z","shell.execute_reply.started":"2024-09-28T18:44:13.298161Z","shell.execute_reply":"2024-09-28T18:44:13.304653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Correlation matrix\nplt.figure(figsize=(25, 18))\ncorr_matrix = numeric_columns.corr()\nsns.heatmap(corr_matrix, annot=True, cmap='coolwarm', fmt='.2f')\nplt.title('Correlation Matrix of Numerical Variables')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-28T18:45:38.357628Z","iopub.execute_input":"2024-09-28T18:45:38.358133Z","iopub.status.idle":"2024-09-28T18:45:51.064717Z","shell.execute_reply.started":"2024-09-28T18:45:38.358088Z","shell.execute_reply":"2024-09-28T18:45:51.063446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.columns","metadata":{"execution":{"iopub.status.busy":"2024-09-28T19:02:09.050272Z","iopub.execute_input":"2024-09-28T19:02:09.051559Z","iopub.status.idle":"2024-09-28T19:02:09.061149Z","shell.execute_reply.started":"2024-09-28T19:02:09.051495Z","shell.execute_reply":"2024-09-28T19:02:09.059817Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}