{"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":"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","execution":{"iopub.status.busy":"2023-05-06T08:55:29.007267Z","iopub.execute_input":"2023-05-06T08:55:29.007663Z","iopub.status.idle":"2023-05-06T08:55:29.028529Z","shell.execute_reply.started":"2023-05-06T08:55:29.007632Z","shell.execute_reply":"2023-05-06T08:55:29.027344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:28:57.599221Z","iopub.execute_input":"2023-05-06T09:28:57.599706Z","iopub.status.idle":"2023-05-06T09:28:57.934050Z","shell.execute_reply.started":"2023-05-06T09:28:57.599662Z","shell.execute_reply":"2023-05-06T09:28:57.933246Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/abalone-dataset/abalone.csv\")\ndf","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:22:39.383113Z","iopub.execute_input":"2023-05-06T09:22:39.383510Z","iopub.status.idle":"2023-05-06T09:22:39.411638Z","shell.execute_reply.started":"2023-05-06T09:22:39.383477Z","shell.execute_reply":"2023-05-06T09:22:39.410426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe(include=\"all\")","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:26:37.003118Z","iopub.execute_input":"2023-05-06T09:26:37.003513Z","iopub.status.idle":"2023-05-06T09:26:37.049840Z","shell.execute_reply.started":"2023-05-06T09:26:37.003484Z","shell.execute_reply":"2023-05-06T09:26:37.048726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:25:28.822239Z","iopub.execute_input":"2023-05-06T09:25:28.822606Z","iopub.status.idle":"2023-05-06T09:25:28.849955Z","shell.execute_reply.started":"2023-05-06T09:25:28.822577Z","shell.execute_reply":"2023-05-06T09:25:28.848792Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"g = sns.pairplot(df, hue='Sex')\ng.fig.legend(labels = [\"M\",\"F\",\"I\"], loc='upper right', ncol=1)","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:46:50.968792Z","iopub.execute_input":"2023-05-06T09:46:50.969209Z","iopub.status.idle":"2023-05-06T09:47:39.455118Z","shell.execute_reply.started":"2023-05-06T09:46:50.969164Z","shell.execute_reply":"2023-05-06T09:47:39.453464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.boxplot(df)","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:41:58.179302Z","iopub.execute_input":"2023-05-06T09:41:58.180531Z","iopub.status.idle":"2023-05-06T09:41:58.502602Z","shell.execute_reply.started":"2023-05-06T09:41:58.180488Z","shell.execute_reply":"2023-05-06T09:41:58.501535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"No. of Outliers in each column:\")\nfor i in df.columns:\n    if df[i].dtype!=\"object\":\n        q1 = df[i].quantile(0.25)\n        q3 = df[i].quantile(0.75)\n        iqr = q3-q1\n        low = q1-1.5*iqr\n        high=q3+1.5*iqr\n        count = df[(df[i]>high) | (df[i]<low)][i].count()\n        print(i,\": \",count)","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:58:44.858793Z","iopub.execute_input":"2023-05-06T09:58:44.859201Z","iopub.status.idle":"2023-05-06T09:58:44.889790Z","shell.execute_reply.started":"2023-05-06T09:58:44.859165Z","shell.execute_reply":"2023-05-06T09:58:44.888545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataplot = sns.heatmap(df.corr(), cmap=\"YlGnBu\", annot=True)","metadata":{"execution":{"iopub.status.busy":"2023-05-06T09:29:51.028262Z","iopub.execute_input":"2023-05-06T09:29:51.028659Z","iopub.status.idle":"2023-05-06T09:29:51.584665Z","shell.execute_reply.started":"2023-05-06T09:29:51.028627Z","shell.execute_reply":"2023-05-06T09:29:51.583737Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.drop(['Diameter',\"Whole weight\"],axis=1, inplace=True)","metadata":{"execution":{"iopub.status.busy":"2023-05-06T10:14:14.498500Z","iopub.execute_input":"2023-05-06T10:14:14.498884Z","iopub.status.idle":"2023-05-06T10:14:14.506477Z","shell.execute_reply.started":"2023-05-06T10:14:14.498856Z","shell.execute_reply":"2023-05-06T10:14:14.505457Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.get_dummies(df, columns=[\"Sex\"])","metadata":{"execution":{"iopub.status.busy":"2023-05-06T10:14:18.297870Z","iopub.execute_input":"2023-05-06T10:14:18.298302Z","iopub.status.idle":"2023-05-06T10:14:18.320482Z","shell.execute_reply.started":"2023-05-06T10:14:18.298261Z","shell.execute_reply":"2023-05-06T10:14:18.319594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.style.use('seaborn-white')\nplt.rcParams['figure.figsize']=15,15 \nplt.rcParams['font.family'] = 'Calibri'\nplt.rcParams['font.size'] = 12\nplt.rcParams['lines.linewidth'] = 0.5\nplt.rcParams['axes.labelsize']=12\nplt.rcParams['xtick.labelsize']=12\nplt.rcParams['ytick.labelsize']=12\nplt.rcParams['legend.fontsize']=12\n\nplt.figure(figsize=(10, 15))\n\n# colors = sns.color_palette()\n\nrows = 7\ncols = 1\ni = 0\n\ni += 1\nplt.subplot(rows, cols, i)\n_ = sns.violinplot(data=df, x='Rings', y='Length')\n\ni += 1\nplt.subplot(rows, cols, i)\n_ = sns.violinplot(data=df, x='Rings', y='Height')\n\ni += 1\nplt.subplot(rows, cols, i)\n_ = sns.violinplot(data=df, x='Rings', y='Shucked weight')\n\ni += 1\nplt.subplot(rows, cols, i)\n_ = sns.violinplot(data=df, x='Rings', y='Viscera weight')\n\ni += 1\nplt.subplot(rows, cols, i)\n_ = sns.violinplot(data=df, x='Rings', y='Shell weight')\n\nsns.despine","metadata":{"execution":{"iopub.status.busy":"2023-05-06T10:19:04.224482Z","iopub.execute_input":"2023-05-06T10:19:04.224852Z","iopub.status.idle":"2023-05-06T10:19:09.924392Z","shell.execute_reply.started":"2023-05-06T10:19:04.224823Z","shell.execute_reply":"2023-05-06T10:19:09.923120Z"},"trusted":true},"execution_count":null,"outputs":[]}]}