{"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","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-09-13T13:54:09.990933Z","iopub.execute_input":"2022-09-13T13:54:09.991475Z","iopub.status.idle":"2022-09-13T13:54:10.002653Z","shell.execute_reply.started":"2022-09-13T13:54:09.991429Z","shell.execute_reply":"2022-09-13T13:54:10.001400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!wget https://raw.githubusercontent.com/JoseCaliz/dotfiles/main/css/custom_css.css 2>/dev/null 1>&2\n!pip install feature_engine 2>/dev/null 1>&2\n    \nfrom IPython.core.display import HTML\nwith open('./custom_css.css', 'r') as file:\n    custom_css = file.read()\n\nHTML(custom_css)","metadata":{"_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-09-13T14:01:33.992481Z","iopub.execute_input":"2022-09-13T14:01:33.992931Z","iopub.status.idle":"2022-09-13T14:01:45.992773Z","shell.execute_reply.started":"2022-09-13T14:01:33.992889Z","shell.execute_reply":"2022-09-13T14:01:45.991530Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"![](https://funart.pro/uploads/posts/2021-04/1617318731_16-p-oboi-dozhdlivaya-osen-18.jpg)","metadata":{}},{"cell_type":"markdown","source":"# <span style=\"color:#FFA500;\">***Tabular Playground Series - Sep 2022***<span>\n_**<span style=\"color:#FFA500;\">I will be grateful if you rate this analysis</span>**_  🖤\n## <span style=\"color:#FFA500;\">**Plan**<span>\n<a id=\"table-of-contents\"></a>\n- [1.EDA](#1)\n","metadata":{}},{"cell_type":"markdown","source":"# Library Import","metadata":{}},{"cell_type":"code","source":"import plotly.express as px\nimport plotly.offline as pyo\nimport plotly\nimport plotly.graph_objs as go\nfrom plotly.subplots import make_subplots\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\ncustom_colors = [\"#a8e6cf\",\"#dcedc1\",\"#ffd3b6\",\"#ffaaa5\",\"#ff8b94\"]\npalette = sns.set_palette(sns.color_palette(custom_colors))","metadata":{"_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-09-13T13:54:24.742444Z","iopub.execute_input":"2022-09-13T13:54:24.743307Z","iopub.status.idle":"2022-09-13T13:54:24.750228Z","shell.execute_reply.started":"2022-09-13T13:54:24.743252Z","shell.execute_reply":"2022-09-13T13:54:24.749385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata = pd.read_csv('../input/open-problems-multimodal/metadata.csv')\nmetadata_city_day_donor = pd.read_csv('../input/open-problems-multimodal/metadata_cite_day_2_donor_27678.csv')","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:05:26.181342Z","iopub.execute_input":"2022-09-13T14:05:26.182268Z","iopub.status.idle":"2022-09-13T14:05:26.458257Z","shell.execute_reply.started":"2022-09-13T14:05:26.182218Z","shell.execute_reply":"2022-09-13T14:05:26.457298Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def basicSummary(dataFrameForSummary):\n    print('\\n\\033[1;30;34mThis Datset consists of \\033[0;0m\\033[1m {}\\033[0m \\033[1;31;31mFeatures\\033[0;0m & \\033[1m{}\\033[0m \\033[1;31;32mSamples.\\033[0;0m\\n'.format(dataFrameForSummary.shape[1], dataFrameForSummary.shape[0]))\n    summary = pd.DataFrame(dataFrameForSummary.dtypes, columns=['Data Type'])\n    summary = summary.reset_index()\n    summary = summary.rename(columns={'index': 'Feature'})\n    summary['Num of Nulls'] = dataFrameForSummary.isnull().sum().values\n    summary['Num of Unique'] = dataFrameForSummary.nunique().values\n    summary['First Value'] = dataFrameForSummary.loc[0].values\n    summary['Num of NaNs'] = dataFrameForSummary.isna().sum().values\n    return summary","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:58:32.798078Z","iopub.execute_input":"2022-09-13T13:58:32.798525Z","iopub.status.idle":"2022-09-13T13:58:32.806753Z","shell.execute_reply.started":"2022-09-13T13:58:32.798488Z","shell.execute_reply":"2022-09-13T13:58:32.805418Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <span style=\"color:#FFA500;\">***EDA***<span>","metadata":{}},{"cell_type":"code","source":"metadata","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:54:25.045784Z","iopub.execute_input":"2022-09-13T13:54:25.046149Z","iopub.status.idle":"2022-09-13T13:54:25.068133Z","shell.execute_reply.started":"2022-09-13T13:54:25.046110Z","shell.execute_reply":"2022-09-13T13:54:25.067059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_city_day_donor","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:05:10.556585Z","iopub.execute_input":"2022-09-13T14:05:10.557539Z","iopub.status.idle":"2022-09-13T14:05:10.577830Z","shell.execute_reply.started":"2022-09-13T14:05:10.557485Z","shell.execute_reply":"2022-09-13T14:05:10.576284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div class = \"alert alert-block alert-warning\" style = 'color : green'> Remove the useless feature</div>","metadata":{}},{"cell_type":"code","source":"metadata.pop('cell_id')\nmetadata_city_day_donor.pop('cell_id')","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-09-13T14:05:29.221173Z","iopub.execute_input":"2022-09-13T14:05:29.221564Z","iopub.status.idle":"2022-09-13T14:05:29.232033Z","shell.execute_reply.started":"2022-09-13T14:05:29.221532Z","shell.execute_reply":"2022-09-13T14:05:29.230974Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = make_subplots(rows=1, cols=2)\nfig.update_layout(\n    title_text=\"<b>Start Dataset Summary metadata</b>\",\n    title_x=0.5\n)\nfig['layout']['title']['font'] = dict(size=35, color='#FFA500')\nfig.add_trace(go.Indicator(mode = \"number\", value = metadata.shape[0], number={'font':{'color': 'rgb(0, 103, 71)','size':100}}, title = {\"text\": \"Rows (Samples)<br><span style='font-size:0.8em;color:rgb(0, 35, 156)'>In the Dataframe</span>\"}, domain = {'x': [0, 0.5], 'y': [0.1, 1]}))\nfig.add_trace(go.Indicator(mode = \"number\", value = metadata.shape[1], number={'font':{'color': 'rgb(0, 103, 71)','size':100}}, title = {\"text\": \"Columns (Features)<br><span style='font-size:0.8em;color:rgb(0, 35, 156)'>In the Dataframe</span>\"}, domain = {'x': [0.5, 1], 'y': [0, 0.4]}))\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:06:19.907077Z","iopub.execute_input":"2022-09-13T14:06:19.907494Z","iopub.status.idle":"2022-09-13T14:06:19.947337Z","shell.execute_reply.started":"2022-09-13T14:06:19.907458Z","shell.execute_reply":"2022-09-13T14:06:19.946075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = make_subplots(rows=1, cols=2)\nfig.update_layout(\n    title_text=\"<b>Start Dataset Summary metadata donor</b>\",\n    title_x=0.5\n)\nfig['layout']['title']['font'] = dict(size=35, color='#FFA500')\nfig.add_trace(go.Indicator(mode = \"number\", value = metadata_city_day_donor.shape[0], number={'font':{'color': 'rgb(0, 103, 71)','size':100}}, title = {\"text\": \"Rows (Samples)<br><span style='font-size:0.8em;color:rgb(0, 35, 156)'>In the Dataframe</span>\"}, domain = {'x': [0, 0.5], 'y': [0.1, 1]}))\nfig.add_trace(go.Indicator(mode = \"number\", value = metadata_city_day_donor.shape[1], number={'font':{'color': 'rgb(0, 103, 71)','size':100}}, title = {\"text\": \"Columns (Features)<br><span style='font-size:0.8em;color:rgb(0, 35, 156)'>In the Dataframe</span>\"}, domain = {'x': [0.5, 1], 'y': [0, 0.4]}))\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:06:38.157742Z","iopub.execute_input":"2022-09-13T14:06:38.158189Z","iopub.status.idle":"2022-09-13T14:06:38.200905Z","shell.execute_reply.started":"2022-09-13T14:06:38.158152Z","shell.execute_reply":"2022-09-13T14:06:38.199812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(basicSummary(metadata_city_day_donor))","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:07:00.231265Z","iopub.execute_input":"2022-09-13T14:07:00.231931Z","iopub.status.idle":"2022-09-13T14:07:00.256809Z","shell.execute_reply.started":"2022-09-13T14:07:00.231882Z","shell.execute_reply":"2022-09-13T14:07:00.255591Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(basicSummary(metadata))","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:07:13.209903Z","iopub.execute_input":"2022-09-13T14:07:13.210329Z","iopub.status.idle":"2022-09-13T14:07:13.321660Z","shell.execute_reply.started":"2022-09-13T14:07:13.210293Z","shell.execute_reply":"2022-09-13T14:07:13.320502Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h4><div class = \"alert alert-block alert-info\" style = 'color : #F4A460'><p  style = 'color : #F4A460'><b> 📌Insights:\n<p  style = 'color : #F4A460'> The data is good.There are no passes</b></h4></p>","metadata":{}},{"cell_type":"code","source":"ax1,ax2 = plt.figure(figsize = (15,10)).subplots(1,2)\nsns.countplot(data=metadata, x ='cell_type', ax=ax1, palette = palette)\nsns.countplot(data=metadata, x ='technology', ax=ax2,palette = palette)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:54:25.291486Z","iopub.execute_input":"2022-09-13T13:54:25.291908Z","iopub.status.idle":"2022-09-13T13:54:25.971916Z","shell.execute_reply.started":"2022-09-13T13:54:25.291866Z","shell.execute_reply":"2022-09-13T13:54:25.970769Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax1,ax2 = plt.figure(figsize = (15,10)).subplots(1,2)\nsns.countplot(data=metadata, x ='donor', ax=ax1, palette = palette)\nsns.violinplot(data=metadata, x ='donor', ax=ax2, palette = palette)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:54:25.973331Z","iopub.execute_input":"2022-09-13T13:54:25.973678Z","iopub.status.idle":"2022-09-13T13:54:26.722805Z","shell.execute_reply.started":"2022-09-13T13:54:25.973647Z","shell.execute_reply":"2022-09-13T13:54:26.721639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax1,ax2 = plt.figure(figsize = (15,10)).subplots(1,2)\nsns.countplot(data=metadata, x ='day', ax=ax1, palette = palette)\nsns.violinplot(data=metadata, x ='day', ax=ax2, palette = palette)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:54:26.726874Z","iopub.execute_input":"2022-09-13T13:54:26.727776Z","iopub.status.idle":"2022-09-13T13:54:27.573260Z","shell.execute_reply.started":"2022-09-13T13:54:26.727739Z","shell.execute_reply":"2022-09-13T13:54:27.571880Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(metadata.corr())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:09:34.722041Z","iopub.execute_input":"2022-09-13T14:09:34.722468Z","iopub.status.idle":"2022-09-13T14:09:34.922496Z","shell.execute_reply.started":"2022-09-13T14:09:34.722434Z","shell.execute_reply":"2022-09-13T14:09:34.921506Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h4><div class = \"alert alert-block alert-info\" style = 'color : #F4A460'><p  style = 'color : #F4A460'><b> 📌Insights:\n<p  style = 'color : #F4A460'> There is no correlation</b></h4></p>","metadata":{}},{"cell_type":"code","source":"metadata.describe().T","metadata":{"execution":{"iopub.status.busy":"2022-09-13T13:54:27.958525Z","iopub.execute_input":"2022-09-13T13:54:27.958892Z","iopub.status.idle":"2022-09-13T13:54:27.996437Z","shell.execute_reply.started":"2022-09-13T13:54:27.958858Z","shell.execute_reply":"2022-09-13T13:54:27.995284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_city_day_donor.describe().T","metadata":{"execution":{"iopub.status.busy":"2022-09-13T14:09:55.500397Z","iopub.execute_input":"2022-09-13T14:09:55.500807Z","iopub.status.idle":"2022-09-13T14:09:55.524707Z","shell.execute_reply.started":"2022-09-13T14:09:55.500772Z","shell.execute_reply":"2022-09-13T14:09:55.523360Z"},"trusted":true},"execution_count":null,"outputs":[]}]}