{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":31234,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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)\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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:32:53.545686Z","iopub.execute_input":"2026-01-12T18:32:53.54605Z","iopub.status.idle":"2026-01-12T18:32:53.560005Z","shell.execute_reply.started":"2026-01-12T18:32:53.546023Z","shell.execute_reply":"2026-01-12T18:32:53.559103Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import plotly.express as px","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:32:53.561726Z","iopub.execute_input":"2026-01-12T18:32:53.56205Z","iopub.status.idle":"2026-01-12T18:32:53.572512Z","shell.execute_reply.started":"2026-01-12T18:32:53.562024Z","shell.execute_reply":"2026-01-12T18:32:53.571531Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport plotly.express as px\nimport plotly.express as px\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:32:53.573876Z","iopub.execute_input":"2026-01-12T18:32:53.574263Z","iopub.status.idle":"2026-01-12T18:32:53.592517Z","shell.execute_reply.started":"2026-01-12T18:32:53.574226Z","shell.execute_reply":"2026-01-12T18:32:53.591508Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df =pd.read_csv(\"/kaggle/input/playground-series-s4e12/train.csv\")\ndf","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:32:54.425616Z","iopub.execute_input":"2026-01-12T18:32:54.426357Z","iopub.status.idle":"2026-01-12T18:32:59.88248Z","shell.execute_reply.started":"2026-01-12T18:32:54.426327Z","shell.execute_reply":"2026-01-12T18:32:59.881548Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.isnull().sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:32:59.884083Z","iopub.execute_input":"2026-01-12T18:32:59.884336Z","iopub.status.idle":"2026-01-12T18:33:00.586832Z","shell.execute_reply.started":"2026-01-12T18:32:59.884314Z","shell.execute_reply":"2026-01-12T18:33:00.585842Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"##calculate the persentage of the \n## TASK.____________missing value data? \n##ploting the data (EDA) to explore potencial and handling the techniques\n###* handle data types\n\n##### detekt the outliers","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:00.587832Z","iopub.execute_input":"2026-01-12T18:33:00.588116Z","iopub.status.idle":"2026-01-12T18:33:00.592343Z","shell.execute_reply.started":"2026-01-12T18:33:00.588079Z","shell.execute_reply":"2026-01-12T18:33:00.591387Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:00.594656Z","iopub.execute_input":"2026-01-12T18:33:00.594964Z","iopub.status.idle":"2026-01-12T18:33:01.32675Z","shell.execute_reply.started":"2026-01-12T18:33:00.594938Z","shell.execute_reply":"2026-01-12T18:33:01.325863Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"###   worning.filterwornings('igniore')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.327841Z","iopub.execute_input":"2026-01-12T18:33:01.328141Z","iopub.status.idle":"2026-01-12T18:33:01.332007Z","shell.execute_reply.started":"2026-01-12T18:33:01.328107Z","shell.execute_reply":"2026-01-12T18:33:01.331238Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":" count_age = df['Age'].value_counts()\n count_age","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.332961Z","iopub.execute_input":"2026-01-12T18:33:01.333242Z","iopub.status.idle":"2026-01-12T18:33:01.369015Z","shell.execute_reply.started":"2026-01-12T18:33:01.333217Z","shell.execute_reply":"2026-01-12T18:33:01.36814Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"count_age_na = df['Age'].isnull().sum()\ncount_age_na","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.370225Z","iopub.execute_input":"2026-01-12T18:33:01.370588Z","iopub.status.idle":"2026-01-12T18:33:01.387333Z","shell.execute_reply.started":"2026-01-12T18:33:01.370562Z","shell.execute_reply":"2026-01-12T18:33:01.386536Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"count_age_na/1200000 * 100","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.388428Z","iopub.execute_input":"2026-01-12T18:33:01.389678Z","iopub.status.idle":"2026-01-12T18:33:01.401983Z","shell.execute_reply.started":"2026-01-12T18:33:01.389616Z","shell.execute_reply":"2026-01-12T18:33:01.401179Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"we want to cheq the null value in all the columns","metadata":{}},{"cell_type":"code","source":"df.shape[0]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.402926Z","iopub.execute_input":"2026-01-12T18:33:01.403857Z","iopub.status.idle":"2026-01-12T18:33:01.418473Z","shell.execute_reply.started":"2026-01-12T18:33:01.403818Z","shell.execute_reply":"2026-01-12T18:33:01.417765Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in df.columns :\n    na = (df[i].isnull().sum() / df.shape[0] *100)\n    print(f\"porsentage missing in{i}  in is : {na} %\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:01.421157Z","iopub.execute_input":"2026-01-12T18:33:01.421449Z","iopub.status.idle":"2026-01-12T18:33:02.098618Z","shell.execute_reply.started":"2026-01-12T18:33:01.421412Z","shell.execute_reply":"2026-01-12T18:33:02.097751Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in df.columns :\n    col_nun = (df[i].isnull().sum() / df.shape[0] *100)\n    print(f\"porsentage missing in{i}  in is : {na} %\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:02.099745Z","iopub.execute_input":"2026-01-12T18:33:02.09999Z","iopub.status.idle":"2026-01-12T18:33:02.759932Z","shell.execute_reply.started":"2026-01-12T18:33:02.099967Z","shell.execute_reply":"2026-01-12T18:33:02.759037Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df. info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:02.761168Z","iopub.execute_input":"2026-01-12T18:33:02.761941Z","iopub.status.idle":"2026-01-12T18:33:03.470197Z","shell.execute_reply.started":"2026-01-12T18:33:02.761915Z","shell.execute_reply":"2026-01-12T18:33:03.46906Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in df.columns :\n    col_nun = (df[i].isnull().sum() )\n    na_per = (col_nun / df.shape[0] ) * 100     \n    print(f\"missing in {i} is : {na_per.round(2)} % \")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:03.471322Z","iopub.execute_input":"2026-01-12T18:33:03.471667Z","iopub.status.idle":"2026-01-12T18:33:04.137386Z","shell.execute_reply.started":"2026-01-12T18:33:03.471607Z","shell.execute_reply":"2026-01-12T18:33:04.136465Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:04.138714Z","iopub.execute_input":"2026-01-12T18:33:04.139059Z","iopub.status.idle":"2026-01-12T18:33:04.84387Z","shell.execute_reply.started":"2026-01-12T18:33:04.139027Z","shell.execute_reply":"2026-01-12T18:33:04.842624Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"QUESTION??????????????????????????????????","metadata":{}},{"cell_type":"code","source":"####handling the data but before we have to cheque of the data types its true or false","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:04.844981Z","iopub.execute_input":"2026-01-12T18:33:04.845318Z","iopub.status.idle":"2026-01-12T18:33:04.849283Z","shell.execute_reply.started":"2026-01-12T18:33:04.845292Z","shell.execute_reply":"2026-01-12T18:33:04.848389Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cat = df.select_dtypes('object').columns\ncat","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:04.850383Z","iopub.execute_input":"2026-01-12T18:33:04.850778Z","iopub.status.idle":"2026-01-12T18:33:05.037685Z","shell.execute_reply.started":"2026-01-12T18:33:04.85074Z","shell.execute_reply":"2026-01-12T18:33:05.036763Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in cat:\n    df[i]= df[i].astype('category')\n    df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:05.038818Z","iopub.execute_input":"2026-01-12T18:33:05.039122Z","iopub.status.idle":"2026-01-12T18:33:10.450826Z","shell.execute_reply.started":"2026-01-12T18:33:05.039086Z","shell.execute_reply":"2026-01-12T18:33:10.449861Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:10.452071Z","iopub.execute_input":"2026-01-12T18:33:10.452445Z","iopub.status.idle":"2026-01-12T18:33:10.49668Z","shell.execute_reply.started":"2026-01-12T18:33:10.452409Z","shell.execute_reply":"2026-01-12T18:33:10.495854Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in df.columns :\n    print(df[i].value_counts())\n    print(\"______________________\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:10.497746Z","iopub.execute_input":"2026-01-12T18:33:10.498031Z","iopub.status.idle":"2026-01-12T18:33:11.070123Z","shell.execute_reply.started":"2026-01-12T18:33:10.497992Z","shell.execute_reply":"2026-01-12T18:33:11.069234Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# step 1 Handlling the data types","metadata":{}},{"cell_type":"markdown","source":"# change the data type of Policy Start date to date and time","metadata":{}},{"cell_type":"code","source":"df['Policy Start Date'] =df['Policy Start Date'].astype('datetime64')\ndf.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.07126Z","iopub.execute_input":"2026-01-12T18:33:11.071624Z","iopub.status.idle":"2026-01-12T18:33:11.246692Z","shell.execute_reply.started":"2026-01-12T18:33:11.071588Z","shell.execute_reply":"2026-01-12T18:33:11.24571Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cat","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.24809Z","iopub.execute_input":"2026-01-12T18:33:11.248717Z","iopub.status.idle":"2026-01-12T18:33:11.254177Z","shell.execute_reply.started":"2026-01-12T18:33:11.248687Z","shell.execute_reply":"2026-01-12T18:33:11.253113Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df['Number of Dependents']= df ['Number of Dependents'].astype('category')\ndf['Previous Claims'] =df['Previous Claims'].astype('category')\ndf","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.255221Z","iopub.execute_input":"2026-01-12T18:33:11.255527Z","iopub.status.idle":"2026-01-12T18:33:11.509079Z","shell.execute_reply.started":"2026-01-12T18:33:11.255501Z","shell.execute_reply":"2026-01-12T18:33:11.508161Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.510238Z","iopub.execute_input":"2026-01-12T18:33:11.511Z","iopub.status.idle":"2026-01-12T18:33:11.557258Z","shell.execute_reply.started":"2026-01-12T18:33:11.510961Z","shell.execute_reply":"2026-01-12T18:33:11.556513Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"###__Remmber to do ORDINAL ENKCODING on these columns because the order is IMPORTANT","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.558965Z","iopub.execute_input":"2026-01-12T18:33:11.559217Z","iopub.status.idle":"2026-01-12T18:33:11.563329Z","shell.execute_reply.started":"2026-01-12T18:33:11.559195Z","shell.execute_reply":"2026-01-12T18:33:11.562533Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## step 2 Handlling the Null values","metadata":{}},{"cell_type":"raw","source":"\n","metadata":{"execution":{"iopub.status.busy":"2025-12-28T00:11:12.505488Z","iopub.execute_input":"2025-12-28T00:11:12.50584Z","iopub.status.idle":"2025-12-28T00:11:12.512128Z","shell.execute_reply.started":"2025-12-28T00:11:12.505811Z","shell.execute_reply":"2025-12-28T00:11:12.511239Z"}}},{"cell_type":"code","source":"def null_percentage (col) :\n    col_nun = df[col].isnull().sum()\n    na_per = (col_nun / df.shape[0] ) * 100\n    return na_per\nfor i in df.columns :\n    if null_percentage(i) > 0 :\n        print(f\"{i} null : {null_percentage(i).round(2)} %\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.564359Z","iopub.execute_input":"2026-01-12T18:33:11.56471Z","iopub.status.idle":"2026-01-12T18:33:11.628318Z","shell.execute_reply.started":"2026-01-12T18:33:11.564669Z","shell.execute_reply":"2026-01-12T18:33:11.627383Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def null_percentage (col) :\n    col_nun = df[col].isnull().sum()\n    na_per = (col_nun / df.shape[0] ) * 100\n    return na_per\nfor i in df.columns :\n    if null_percentage(i) > 0 :\n        print(f\"{i} null : {null_percentage(i).round(2)} \")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.629528Z","iopub.execute_input":"2026-01-12T18:33:11.629892Z","iopub.status.idle":"2026-01-12T18:33:11.683188Z","shell.execute_reply.started":"2026-01-12T18:33:11.629847Z","shell.execute_reply":"2026-01-12T18:33:11.682291Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cat\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.68428Z","iopub.execute_input":"2026-01-12T18:33:11.68456Z","iopub.status.idle":"2026-01-12T18:33:11.69096Z","shell.execute_reply.started":"2026-01-12T18:33:11.684536Z","shell.execute_reply":"2026-01-12T18:33:11.690068Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df = df.drop('id' , axis=1)\ndf","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.695066Z","iopub.execute_input":"2026-01-12T18:33:11.695372Z","iopub.status.idle":"2026-01-12T18:33:11.756143Z","shell.execute_reply.started":"2026-01-12T18:33:11.695346Z","shell.execute_reply":"2026-01-12T18:33:11.755251Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.describe().T","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:11.757316Z","iopub.execute_input":"2026-01-12T18:33:11.757709Z","iopub.status.idle":"2026-01-12T18:33:12.223999Z","shell.execute_reply.started":"2026-01-12T18:33:11.75767Z","shell.execute_reply":"2026-01-12T18:33:12.222973Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.224908Z","iopub.execute_input":"2026-01-12T18:33:12.22515Z","iopub.status.idle":"2026-01-12T18:33:12.27432Z","shell.execute_reply.started":"2026-01-12T18:33:12.225127Z","shell.execute_reply":"2026-01-12T18:33:12.273521Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.275671Z","iopub.execute_input":"2026-01-12T18:33:12.276019Z","iopub.status.idle":"2026-01-12T18:33:12.280355Z","shell.execute_reply.started":"2026-01-12T18:33:12.275978Z","shell.execute_reply":"2026-01-12T18:33:12.279443Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt\n\nnumeric_cols = df.select_dtypes(include=['float64', 'int64']).columns\n\nplt.figure(figsize=(10, 8))\nsns.heatmap(df[numeric_cols].corr(),\n    annot=True,\n    cmap='coolwarm',\n    fmt='.2f',\n    linewidths=0.5\n)\n\nplt.title('Correlation heatmap for all numerical features')\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.281499Z","iopub.execute_input":"2026-01-12T18:33:12.28186Z","iopub.status.idle":"2026-01-12T18:33:12.899601Z","shell.execute_reply.started":"2026-01-12T18:33:12.281824Z","shell.execute_reply":"2026-01-12T18:33:12.89873Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(8, 5))\nsns.barplot(\n    x=education_counts.index,\n    y=education_counts.values\n)\n\nplt.xlabel('Education Level')\nplt.ylabel('Count')\nplt.title('Distribution of Education Level')\nplt.tight_layout()\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.900745Z","iopub.execute_input":"2026-01-12T18:33:12.90109Z","iopub.status.idle":"2026-01-12T18:33:12.913558Z","shell.execute_reply.started":"2026-01-12T18:33:12.901053Z","shell.execute_reply":"2026-01-12T18:33:12.912469Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":" fig = px.pie(df, names= 'Education Level' , title=f\"Distribution of {'Education Level'}\")\n \n    fig.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.914774Z","iopub.status.idle":"2026-01-12T18:33:12.915176Z","shell.execute_reply.started":"2026-01-12T18:33:12.914949Z","shell.execute_reply":"2026-01-12T18:33:12.914977Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\n\ncolor_counts = df['Color'].value_counts().reset_index()\ncolor_counts.columns = ['Color', 'Count']\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.916871Z","iopub.status.idle":"2026-01-12T18:33:12.917284Z","shell.execute_reply.started":"2026-01-12T18:33:12.917088Z","shell.execute_reply":"2026-01-12T18:33:12.917115Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(8, 5))\nsns.barplot(\n    data=color_counts,\n    x='Color',\n    y='Count'\n)\n\nplt.xlabel('Color')\nplt.ylabel('Count')\nplt.title('Distribution of Color')\nplt.tight_layout()\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.918791Z","iopub.status.idle":"2026-01-12T18:33:12.919094Z","shell.execute_reply.started":"2026-01-12T18:33:12.918956Z","shell.execute_reply":"2026-01-12T18:33:12.918973Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = px.bar(df['Color'].value_counts().reset_index(), \n             x='index', y='Color', labels={'index':'Color', 'Color':'Count'})","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.919961Z","iopub.status.idle":"2026-01-12T18:33:12.920224Z","shell.execute_reply.started":"2026-01-12T18:33:12.920097Z","shell.execute_reply":"2026-01-12T18:33:12.920112Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for col in cat:\n    fig = px.bar(df, x='Education Level' , title=f\"Distribution of {col}\")\n    fig.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:36:32.895634Z","iopub.execute_input":"2026-01-12T18:36:32.896132Z","iopub.status.idle":"2026-01-12T18:36:32.908461Z","shell.execute_reply.started":"2026-01-12T18:36:32.896081Z","shell.execute_reply":"2026-01-12T18:36:32.906547Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in cat:\n      fig = px.histogram(df , x = i , color ='Location', title = f'Distribution of {i}based on Age')\n      fig.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.924618Z","iopub.status.idle":"2026-01-12T18:33:12.924976Z","shell.execute_reply.started":"2026-01-12T18:33:12.924825Z","shell.execute_reply":"2026-01-12T18:33:12.924843Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\n\nfor i in cat:\n    plt.figure(figsize=(8, 5))\n    sns.histplot(\n        data=df,\n        x=i,\n        hue='Location',\n        multiple='stack'   # closest to Plotly behavior\n    )\n\n    plt.title(f'Distribution of {i} based on Location')\n    plt.xlabel(i)\n    plt.ylabel('Count')\n    plt.tight_layout()\n    plt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.926602Z","iopub.status.idle":"2026-01-12T18:33:12.926928Z","shell.execute_reply.started":"2026-01-12T18:33:12.926794Z","shell.execute_reply":"2026-01-12T18:33:12.926812Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nplt.figure(figsize=(8, 5))\nplt.hist(df['Age'], bins=10)\n\nplt.xlabel('Age')\nplt.ylabel('Frequency')\nplt.title('Distribution of Age')\nplt.tight_layout()\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.928298Z","iopub.status.idle":"2026-01-12T18:33:12.928637Z","shell.execute_reply.started":"2026-01-12T18:33:12.928471Z","shell.execute_reply":"2026-01-12T18:33:12.928499Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\n\ncol = 'Age'   # make sure this exists\n\nplt.figure(figsize=(8, 5))\nsns.histplot(\n    data=df,\n    x=col,\n    bins=10\n)\n\nplt.xlabel(col)\nplt.ylabel('Count')\nplt.title(f'Distribution of {col}')\nplt.tight_layout()\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.930008Z","iopub.status.idle":"2026-01-12T18:33:12.930427Z","shell.execute_reply.started":"2026-01-12T18:33:12.93021Z","shell.execute_reply":"2026-01-12T18:33:12.930233Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = px.histogram(df, x='Age', title=f\"Distribution of {col}\")\nfig.show()\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.93182Z","iopub.status.idle":"2026-01-12T18:33:12.932089Z","shell.execute_reply.started":"2026-01-12T18:33:12.93196Z","shell.execute_reply":"2026-01-12T18:33:12.931976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(8, 5))\nplt.bar(color_counts['Color'], color_counts['Count'])\n\nplt.xlabel('Color')\nplt.ylabel('Count')\nplt.title('Distribution of Color')\nplt.tight_layout()\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-12T18:33:12.932877Z","iopub.status.idle":"2026-01-12T18:33:12.933132Z","shell.execute_reply.started":"2026-01-12T18:33:12.933009Z","shell.execute_reply":"2026-01-12T18:33:12.933024Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}