{"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":"markdown","source":"#        <font color=red>EDA & Visulizations</font>","metadata":{}},{"cell_type":"markdown","source":"## <font color =red>Introduction</font>","metadata":{}},{"cell_type":"markdown","source":" > H&M Group is a family of brands and businesses with 53 online markets and approximately 4,850 stores. Our online store offers shoppers an extensive selection of products to browse through. But with too many choices, customers might not quickly find what interests them or what they are looking for, and ultimately, they might not make a purchase. To enhance the shopping experience, product recommendations are key. More importantly, helping customers make the right choices also has a positive implications for sustainability, as it reduces returns, and thereby minimizes emissions from transportation.\n\nIn this competition, H&M Group invites you to develop product recommendations based on data from previous transactions, as well as from customer and product meta data. The available meta data spans from simple data, such as garment type and customer age, to text data from product descriptions, to image data from garment images.\n\nThere are no preconceptions on what information that may be useful – that is for you to find out. If you want to investigate a categorical data type algorithm, or dive into NLP and image processing deep learning, that is up to you.","metadata":{}},{"cell_type":"markdown","source":"## <font color=red>Data Description</font>","metadata":{}},{"cell_type":"markdown","source":"* For this challenge you are given the purchase history of customers across time, along with supporting metadata\n* Your challenge is to predict what articles each customer will purchase in the 7-day period immediately after the training data ends.\n* Customer who did not make any purchase during that time are excluded from the scoring.","metadata":{}},{"cell_type":"markdown","source":"### Three important steps to keep in mind are:\n1- Understand the data \n\n2- Clean the data\n\n3- Find a realtionship between data","metadata":{}},{"cell_type":"code","source":"#  important libraries\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:19:43.052060Z","iopub.execute_input":"2022-02-21T05:19:43.053942Z","iopub.status.idle":"2022-02-21T05:19:43.060703Z","shell.execute_reply.started":"2022-02-21T05:19:43.053883Z","shell.execute_reply":"2022-02-21T05:19:43.059336Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles = pd.read_csv('../input/h-and-m-personalized-fashion-recommendations/articles.csv')\ncustomers = pd.read_csv('../input/h-and-m-personalized-fashion-recommendations/customers.csv')\ntransactions_train = pd.read_csv('../input/h-and-m-personalized-fashion-recommendations/transactions_train.csv')\nsample_submission = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/sample_submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:19:43.063822Z","iopub.execute_input":"2022-02-21T05:19:43.064234Z","iopub.status.idle":"2022-02-21T05:20:52.282461Z","shell.execute_reply.started":"2022-02-21T05:19:43.064181Z","shell.execute_reply":"2022-02-21T05:20:52.281263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art = articles\nart","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:52.308619Z","iopub.execute_input":"2022-02-21T05:20:52.308925Z","iopub.status.idle":"2022-02-21T05:20:52.626223Z","shell.execute_reply.started":"2022-02-21T05:20:52.308889Z","shell.execute_reply":"2022-02-21T05:20:52.624999Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.info()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:52.629349Z","iopub.execute_input":"2022-02-21T05:20:52.630204Z","iopub.status.idle":"2022-02-21T05:20:52.969921Z","shell.execute_reply.started":"2022-02-21T05:20:52.630043Z","shell.execute_reply":"2022-02-21T05:20:52.968838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust = customers\ncust","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:52.972330Z","iopub.execute_input":"2022-02-21T05:20:52.972707Z","iopub.status.idle":"2022-02-21T05:20:52.998910Z","shell.execute_reply.started":"2022-02-21T05:20:52.972674Z","shell.execute_reply":"2022-02-21T05:20:52.997824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customers.info()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:53.000607Z","iopub.execute_input":"2022-02-21T05:20:53.001102Z","iopub.status.idle":"2022-02-21T05:20:53.650518Z","shell.execute_reply.started":"2022-02-21T05:20:53.001052Z","shell.execute_reply":"2022-02-21T05:20:53.649584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans = transactions_train\ntrans","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:53.651936Z","iopub.execute_input":"2022-02-21T05:20:53.652169Z","iopub.status.idle":"2022-02-21T05:20:53.670775Z","shell.execute_reply.started":"2022-02-21T05:20:53.652141Z","shell.execute_reply":"2022-02-21T05:20:53.669493Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions_train.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:53.672594Z","iopub.execute_input":"2022-02-21T05:20:53.673769Z","iopub.status.idle":"2022-02-21T05:20:53.692292Z","shell.execute_reply.started":"2022-02-21T05:20:53.673707Z","shell.execute_reply":"2022-02-21T05:20:53.691426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample = sample_submission\nsample","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:53.694586Z","iopub.execute_input":"2022-02-21T05:20:53.695649Z","iopub.status.idle":"2022-02-21T05:20:53.719498Z","shell.execute_reply.started":"2022-02-21T05:20:53.695608Z","shell.execute_reply":"2022-02-21T05:20:53.718414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:53.722101Z","iopub.execute_input":"2022-02-21T05:20:53.723592Z","iopub.status.idle":"2022-02-21T05:20:54.035163Z","shell.execute_reply.started":"2022-02-21T05:20:53.723521Z","shell.execute_reply":"2022-02-21T05:20:54.034214Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.head()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.038919Z","iopub.execute_input":"2022-02-21T05:20:54.039211Z","iopub.status.idle":"2022-02-21T05:20:54.070557Z","shell.execute_reply.started":"2022-02-21T05:20:54.039177Z","shell.execute_reply":"2022-02-21T05:20:54.069673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.tail()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.072510Z","iopub.execute_input":"2022-02-21T05:20:54.072770Z","iopub.status.idle":"2022-02-21T05:20:54.106912Z","shell.execute_reply.started":"2022-02-21T05:20:54.072740Z","shell.execute_reply":"2022-02-21T05:20:54.105894Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.head()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.108738Z","iopub.execute_input":"2022-02-21T05:20:54.109094Z","iopub.status.idle":"2022-02-21T05:20:54.132646Z","shell.execute_reply.started":"2022-02-21T05:20:54.109059Z","shell.execute_reply":"2022-02-21T05:20:54.131563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.134446Z","iopub.execute_input":"2022-02-21T05:20:54.134907Z","iopub.status.idle":"2022-02-21T05:20:54.150416Z","shell.execute_reply.started":"2022-02-21T05:20:54.134846Z","shell.execute_reply":"2022-02-21T05:20:54.149473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.151836Z","iopub.execute_input":"2022-02-21T05:20:54.152236Z","iopub.status.idle":"2022-02-21T05:20:54.164068Z","shell.execute_reply.started":"2022-02-21T05:20:54.152184Z","shell.execute_reply":"2022-02-21T05:20:54.163055Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.165924Z","iopub.execute_input":"2022-02-21T05:20:54.166828Z","iopub.status.idle":"2022-02-21T05:20:54.181201Z","shell.execute_reply.started":"2022-02-21T05:20:54.166786Z","shell.execute_reply":"2022-02-21T05:20:54.179945Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.183298Z","iopub.execute_input":"2022-02-21T05:20:54.185079Z","iopub.status.idle":"2022-02-21T05:20:54.196722Z","shell.execute_reply.started":"2022-02-21T05:20:54.185038Z","shell.execute_reply":"2022-02-21T05:20:54.195823Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.198391Z","iopub.execute_input":"2022-02-21T05:20:54.198960Z","iopub.status.idle":"2022-02-21T05:20:54.211867Z","shell.execute_reply.started":"2022-02-21T05:20:54.198913Z","shell.execute_reply":"2022-02-21T05:20:54.210955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.213613Z","iopub.execute_input":"2022-02-21T05:20:54.214175Z","iopub.status.idle":"2022-02-21T05:20:54.332326Z","shell.execute_reply.started":"2022-02-21T05:20:54.214101Z","shell.execute_reply":"2022-02-21T05:20:54.331097Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.333860Z","iopub.execute_input":"2022-02-21T05:20:54.334167Z","iopub.status.idle":"2022-02-21T05:20:54.554857Z","shell.execute_reply.started":"2022-02-21T05:20:54.334114Z","shell.execute_reply":"2022-02-21T05:20:54.553961Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:54.556247Z","iopub.execute_input":"2022-02-21T05:20:54.556524Z","iopub.status.idle":"2022-02-21T05:20:58.267910Z","shell.execute_reply.started":"2022-02-21T05:20:54.556492Z","shell.execute_reply":"2022-02-21T05:20:58.266993Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:20:58.269161Z","iopub.execute_input":"2022-02-21T05:20:58.269481Z","iopub.status.idle":"2022-02-21T05:21:00.401121Z","shell.execute_reply.started":"2022-02-21T05:20:58.269449Z","shell.execute_reply":"2022-02-21T05:21:00.400280Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.nunique","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.402328Z","iopub.execute_input":"2022-02-21T05:21:00.402569Z","iopub.status.idle":"2022-02-21T05:21:00.468802Z","shell.execute_reply.started":"2022-02-21T05:21:00.402538Z","shell.execute_reply":"2022-02-21T05:21:00.467952Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.nunique","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.470030Z","iopub.execute_input":"2022-02-21T05:21:00.470264Z","iopub.status.idle":"2022-02-21T05:21:00.486334Z","shell.execute_reply.started":"2022-02-21T05:21:00.470237Z","shell.execute_reply":"2022-02-21T05:21:00.484895Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.nunique","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.488131Z","iopub.execute_input":"2022-02-21T05:21:00.489076Z","iopub.status.idle":"2022-02-21T05:21:00.505632Z","shell.execute_reply.started":"2022-02-21T05:21:00.489030Z","shell.execute_reply":"2022-02-21T05:21:00.504780Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.columns","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.507316Z","iopub.execute_input":"2022-02-21T05:21:00.507897Z","iopub.status.idle":"2022-02-21T05:21:00.522312Z","shell.execute_reply.started":"2022-02-21T05:21:00.507851Z","shell.execute_reply":"2022-02-21T05:21:00.521294Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.columns","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.524186Z","iopub.execute_input":"2022-02-21T05:21:00.524512Z","iopub.status.idle":"2022-02-21T05:21:00.536688Z","shell.execute_reply.started":"2022-02-21T05:21:00.524469Z","shell.execute_reply":"2022-02-21T05:21:00.535851Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.columns","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.538485Z","iopub.execute_input":"2022-02-21T05:21:00.538802Z","iopub.status.idle":"2022-02-21T05:21:00.552883Z","shell.execute_reply.started":"2022-02-21T05:21:00.538762Z","shell.execute_reply":"2022-02-21T05:21:00.552051Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Cleaning and Filtering the data","metadata":{}},{"cell_type":"code","source":"# find missing values inside\nart.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.559030Z","iopub.execute_input":"2022-02-21T05:21:00.559441Z","iopub.status.idle":"2022-02-21T05:21:00.733257Z","shell.execute_reply.started":"2022-02-21T05:21:00.559410Z","shell.execute_reply":"2022-02-21T05:21:00.732406Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#removing missing value column (cleaning data)\nart_clean = art.drop(['detail_desc'], axis=1)\nart_clean.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.734456Z","iopub.execute_input":"2022-02-21T05:21:00.734695Z","iopub.status.idle":"2022-02-21T05:21:00.775854Z","shell.execute_reply.started":"2022-02-21T05:21:00.734665Z","shell.execute_reply":"2022-02-21T05:21:00.774298Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.777492Z","iopub.execute_input":"2022-02-21T05:21:00.778365Z","iopub.status.idle":"2022-02-21T05:21:00.935314Z","shell.execute_reply.started":"2022-02-21T05:21:00.778314Z","shell.execute_reply":"2022-02-21T05:21:00.934453Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean = art_clean.dropna()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:00.936733Z","iopub.execute_input":"2022-02-21T05:21:00.937418Z","iopub.status.idle":"2022-02-21T05:21:01.108687Z","shell.execute_reply.started":"2022-02-21T05:21:00.937380Z","shell.execute_reply":"2022-02-21T05:21:01.107554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.110073Z","iopub.execute_input":"2022-02-21T05:21:01.110330Z","iopub.status.idle":"2022-02-21T05:21:01.115858Z","shell.execute_reply.started":"2022-02-21T05:21:01.110298Z","shell.execute_reply":"2022-02-21T05:21:01.115021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.117234Z","iopub.execute_input":"2022-02-21T05:21:01.117861Z","iopub.status.idle":"2022-02-21T05:21:01.281724Z","shell.execute_reply.started":"2022-02-21T05:21:01.117813Z","shell.execute_reply":"2022-02-21T05:21:01.280652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.283227Z","iopub.execute_input":"2022-02-21T05:21:01.283574Z","iopub.status.idle":"2022-02-21T05:21:01.293521Z","shell.execute_reply.started":"2022-02-21T05:21:01.283526Z","shell.execute_reply":"2022-02-21T05:21:01.292599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.294659Z","iopub.execute_input":"2022-02-21T05:21:01.294880Z","iopub.status.idle":"2022-02-21T05:21:01.309811Z","shell.execute_reply.started":"2022-02-21T05:21:01.294853Z","shell.execute_reply":"2022-02-21T05:21:01.308840Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art_clean['article_id'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.311413Z","iopub.execute_input":"2022-02-21T05:21:01.311878Z","iopub.status.idle":"2022-02-21T05:21:01.340955Z","shell.execute_reply.started":"2022-02-21T05:21:01.311842Z","shell.execute_reply":"2022-02-21T05:21:01.340093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"art.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.342501Z","iopub.execute_input":"2022-02-21T05:21:01.343296Z","iopub.status.idle":"2022-02-21T05:21:01.419485Z","shell.execute_reply.started":"2022-02-21T05:21:01.343245Z","shell.execute_reply":"2022-02-21T05:21:01.418491Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:01.421030Z","iopub.execute_input":"2022-02-21T05:21:01.421371Z","iopub.status.idle":"2022-02-21T05:21:02.068694Z","shell.execute_reply.started":"2022-02-21T05:21:01.421327Z","shell.execute_reply":"2022-02-21T05:21:02.067563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(cust[\"age\"])","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:02.070200Z","iopub.execute_input":"2022-02-21T05:21:02.070785Z","iopub.status.idle":"2022-02-21T05:21:07.879480Z","shell.execute_reply.started":"2022-02-21T05:21:02.070734Z","shell.execute_reply":"2022-02-21T05:21:07.878834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.fillna(0)","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:07.880955Z","iopub.execute_input":"2022-02-21T05:21:07.881335Z","iopub.status.idle":"2022-02-21T05:21:08.603957Z","shell.execute_reply.started":"2022-02-21T05:21:07.881297Z","shell.execute_reply":"2022-02-21T05:21:08.603007Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#removing missing value column (cleaning data)\ncust_clean = cust.drop(['FN'], axis=1)\ncust_clean.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.605343Z","iopub.execute_input":"2022-02-21T05:21:08.605660Z","iopub.status.idle":"2022-02-21T05:21:08.693479Z","shell.execute_reply.started":"2022-02-21T05:21:08.605620Z","shell.execute_reply":"2022-02-21T05:21:08.692533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# out liers removel\\\ncust_clean[\"age\"].mean()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.694858Z","iopub.execute_input":"2022-02-21T05:21:08.695191Z","iopub.status.idle":"2022-02-21T05:21:08.702971Z","shell.execute_reply.started":"2022-02-21T05:21:08.695160Z","shell.execute_reply":"2022-02-21T05:21:08.702011Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean = cust_clean[cust_clean['age'] < 50]\ncust_clean.head()\n\n\n\n","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.704173Z","iopub.execute_input":"2022-02-21T05:21:08.704486Z","iopub.status.idle":"2022-02-21T05:21:08.815092Z","shell.execute_reply.started":"2022-02-21T05:21:08.704458Z","shell.execute_reply":"2022-02-21T05:21:08.814022Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.816970Z","iopub.execute_input":"2022-02-21T05:21:08.817596Z","iopub.status.idle":"2022-02-21T05:21:08.824866Z","shell.execute_reply.started":"2022-02-21T05:21:08.817549Z","shell.execute_reply":"2022-02-21T05:21:08.823845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean[\"age\"].mean()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.826676Z","iopub.execute_input":"2022-02-21T05:21:08.826918Z","iopub.status.idle":"2022-02-21T05:21:08.847180Z","shell.execute_reply.started":"2022-02-21T05:21:08.826890Z","shell.execute_reply":"2022-02-21T05:21:08.845705Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(cust_clean[\"age\"])","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:08.848872Z","iopub.execute_input":"2022-02-21T05:21:08.849555Z","iopub.status.idle":"2022-02-21T05:21:13.090269Z","shell.execute_reply.started":"2022-02-21T05:21:08.849504Z","shell.execute_reply":"2022-02-21T05:21:13.089217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.boxplot(x= \"Active\", y= \"age\", data= cust_clean)","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:13.091932Z","iopub.execute_input":"2022-02-21T05:21:13.092301Z","iopub.status.idle":"2022-02-21T05:21:13.384957Z","shell.execute_reply.started":"2022-02-21T05:21:13.092262Z","shell.execute_reply":"2022-02-21T05:21:13.383888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:13.386245Z","iopub.execute_input":"2022-02-21T05:21:13.386768Z","iopub.status.idle":"2022-02-21T05:21:13.401626Z","shell.execute_reply.started":"2022-02-21T05:21:13.386717Z","shell.execute_reply":"2022-02-21T05:21:13.400640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.boxplot()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:13.403093Z","iopub.execute_input":"2022-02-21T05:21:13.403446Z","iopub.status.idle":"2022-02-21T05:21:16.601632Z","shell.execute_reply.started":"2022-02-21T05:21:13.403402Z","shell.execute_reply":"2022-02-21T05:21:16.601037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean = cust_clean[cust_clean['Active'] < 300]\ncust_clean.boxplot()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:16.602848Z","iopub.execute_input":"2022-02-21T05:21:16.603247Z","iopub.status.idle":"2022-02-21T05:21:18.141754Z","shell.execute_reply.started":"2022-02-21T05:21:16.603211Z","shell.execute_reply":"2022-02-21T05:21:18.141019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(cust_clean['Active'])","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:18.142933Z","iopub.execute_input":"2022-02-21T05:21:18.143405Z","iopub.status.idle":"2022-02-21T05:21:18.521455Z","shell.execute_reply.started":"2022-02-21T05:21:18.143366Z","shell.execute_reply":"2022-02-21T05:21:18.520773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.hist()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:18.522960Z","iopub.execute_input":"2022-02-21T05:21:18.523243Z","iopub.status.idle":"2022-02-21T05:21:18.939934Z","shell.execute_reply.started":"2022-02-21T05:21:18.523207Z","shell.execute_reply":"2022-02-21T05:21:18.939018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.value_counts(cust_clean[\"Active\"]).plot.bar()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:18.941475Z","iopub.execute_input":"2022-02-21T05:21:18.941714Z","iopub.status.idle":"2022-02-21T05:21:19.656025Z","shell.execute_reply.started":"2022-02-21T05:21:18.941685Z","shell.execute_reply":"2022-02-21T05:21:19.655403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.groupby([\"Active\", \"age\"]).mean()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:19.657114Z","iopub.execute_input":"2022-02-21T05:21:19.657449Z","iopub.status.idle":"2022-02-21T05:21:19.862969Z","shell.execute_reply.started":"2022-02-21T05:21:19.657422Z","shell.execute_reply":"2022-02-21T05:21:19.862100Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.groupby([\"FN\", \"Active\", \"age\"]).mean()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:19.865185Z","iopub.execute_input":"2022-02-21T05:21:19.865949Z","iopub.status.idle":"2022-02-21T05:21:20.632037Z","shell.execute_reply.started":"2022-02-21T05:21:19.865898Z","shell.execute_reply":"2022-02-21T05:21:20.631037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:20.633511Z","iopub.execute_input":"2022-02-21T05:21:20.633986Z","iopub.status.idle":"2022-02-21T05:21:20.649428Z","shell.execute_reply.started":"2022-02-21T05:21:20.633952Z","shell.execute_reply":"2022-02-21T05:21:20.648611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust.tail()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:20.650629Z","iopub.execute_input":"2022-02-21T05:21:20.650995Z","iopub.status.idle":"2022-02-21T05:21:20.677118Z","shell.execute_reply.started":"2022-02-21T05:21:20.650963Z","shell.execute_reply":"2022-02-21T05:21:20.676074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# find missing values inside\ntrans.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:20.678461Z","iopub.execute_input":"2022-02-21T05:21:20.678714Z","iopub.status.idle":"2022-02-21T05:21:27.769686Z","shell.execute_reply.started":"2022-02-21T05:21:20.678684Z","shell.execute_reply":"2022-02-21T05:21:27.768522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:27.771212Z","iopub.execute_input":"2022-02-21T05:21:27.771483Z","iopub.status.idle":"2022-02-21T05:21:31.082313Z","shell.execute_reply.started":"2022-02-21T05:21:27.771451Z","shell.execute_reply":"2022-02-21T05:21:31.081189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.084083Z","iopub.execute_input":"2022-02-21T05:21:31.084434Z","iopub.status.idle":"2022-02-21T05:21:31.096035Z","shell.execute_reply.started":"2022-02-21T05:21:31.084389Z","shell.execute_reply":"2022-02-21T05:21:31.095321Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Relationship","metadata":{}},{"cell_type":"code","source":"art_clean.corr()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.097493Z","iopub.execute_input":"2022-02-21T05:21:31.097755Z","iopub.status.idle":"2022-02-21T05:21:31.171460Z","shell.execute_reply.started":"2022-02-21T05:21:31.097717Z","shell.execute_reply":"2022-02-21T05:21:31.170746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cust_clean.corr()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.172530Z","iopub.execute_input":"2022-02-21T05:21:31.172742Z","iopub.status.idle":"2022-02-21T05:21:31.191453Z","shell.execute_reply.started":"2022-02-21T05:21:31.172717Z","shell.execute_reply":"2022-02-21T05:21:31.190589Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"corr_art_clean = art_clean.corr()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.192391Z","iopub.execute_input":"2022-02-21T05:21:31.193151Z","iopub.status.idle":"2022-02-21T05:21:31.245292Z","shell.execute_reply.started":"2022-02-21T05:21:31.193100Z","shell.execute_reply":"2022-02-21T05:21:31.244096Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"corr_cust_clean = cust_clean.corr()","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.246991Z","iopub.execute_input":"2022-02-21T05:21:31.247351Z","iopub.status.idle":"2022-02-21T05:21:31.261867Z","shell.execute_reply.started":"2022-02-21T05:21:31.247306Z","shell.execute_reply":"2022-02-21T05:21:31.260750Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(corr_art_clean, annot= True)","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:31.263378Z","iopub.execute_input":"2022-02-21T05:21:31.264258Z","iopub.status.idle":"2022-02-21T05:21:32.391665Z","shell.execute_reply.started":"2022-02-21T05:21:31.264208Z","shell.execute_reply":"2022-02-21T05:21:32.390619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(corr_cust_clean, annot= True)","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:32.392987Z","iopub.execute_input":"2022-02-21T05:21:32.393328Z","iopub.status.idle":"2022-02-21T05:21:32.684413Z","shell.execute_reply.started":"2022-02-21T05:21:32.393291Z","shell.execute_reply":"2022-02-21T05:21:32.683572Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.relplot(x = \"article_id\", y= \"section_no\",hue=\"product_code\", data=art_clean)","metadata":{"execution":{"iopub.status.busy":"2022-02-21T05:21:32.687929Z","iopub.execute_input":"2022-02-21T05:21:32.688437Z","iopub.status.idle":"2022-02-21T05:21:40.945283Z","shell.execute_reply.started":"2022-02-21T05:21:32.688368Z","shell.execute_reply":"2022-02-21T05:21:40.944190Z"},"trusted":true},"execution_count":null,"outputs":[]}]}