{"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":"%matplotlib inline\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:27.812079Z","iopub.execute_input":"2022-03-02T22:16:27.812744Z","iopub.status.idle":"2022-03-02T22:16:27.819960Z","shell.execute_reply.started":"2022-03-02T22:16:27.812695Z","shell.execute_reply":"2022-03-02T22:16:27.818931Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%html \n<marquee><h1>Thank you so much for taking time to have a look at my notebook. Please upvote if you like my work.</h1></marquee>","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:27.821802Z","iopub.execute_input":"2022-03-02T22:16:27.822137Z","iopub.status.idle":"2022-03-02T22:16:27.835541Z","shell.execute_reply.started":"2022-03-02T22:16:27.822104Z","shell.execute_reply":"2022-03-02T22:16:27.834614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/articles.csv\")\na.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:27.837258Z","iopub.execute_input":"2022-03-02T22:16:27.837538Z","iopub.status.idle":"2022-03-02T22:16:28.863817Z","shell.execute_reply.started":"2022-03-02T22:16:27.837504Z","shell.execute_reply":"2022-03-02T22:16:28.862743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:28.865868Z","iopub.execute_input":"2022-03-02T22:16:28.866219Z","iopub.status.idle":"2022-03-02T22:16:28.875423Z","shell.execute_reply.started":"2022-03-02T22:16:28.866172Z","shell.execute_reply":"2022-03-02T22:16:28.874444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.columns","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:28.877778Z","iopub.execute_input":"2022-03-02T22:16:28.878437Z","iopub.status.idle":"2022-03-02T22:16:28.888881Z","shell.execute_reply.started":"2022-03-02T22:16:28.878389Z","shell.execute_reply":"2022-03-02T22:16:28.888235Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.shape","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:28.890455Z","iopub.execute_input":"2022-03-02T22:16:28.890886Z","iopub.status.idle":"2022-03-02T22:16:28.904045Z","shell.execute_reply.started":"2022-03-02T22:16:28.890852Z","shell.execute_reply":"2022-03-02T22:16:28.903427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:28.905399Z","iopub.execute_input":"2022-03-02T22:16:28.905843Z","iopub.status.idle":"2022-03-02T22:16:29.082414Z","shell.execute_reply.started":"2022-03-02T22:16:28.905806Z","shell.execute_reply":"2022-03-02T22:16:29.081531Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.prod_name.unique()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:29.084135Z","iopub.execute_input":"2022-03-02T22:16:29.084646Z","iopub.status.idle":"2022-03-02T22:16:29.108881Z","shell.execute_reply.started":"2022-03-02T22:16:29.084601Z","shell.execute_reply":"2022-03-02T22:16:29.107974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.info()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:29.110129Z","iopub.execute_input":"2022-03-02T22:16:29.110983Z","iopub.status.idle":"2022-03-02T22:16:29.286633Z","shell.execute_reply.started":"2022-03-02T22:16:29.110946Z","shell.execute_reply":"2022-03-02T22:16:29.285641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"b = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/customers.csv\")\nb.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:29.288017Z","iopub.execute_input":"2022-03-02T22:16:29.288275Z","iopub.status.idle":"2022-03-02T22:16:33.471784Z","shell.execute_reply.started":"2022-03-02T22:16:29.288245Z","shell.execute_reply":"2022-03-02T22:16:33.470688Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"b.info()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:33.474933Z","iopub.execute_input":"2022-03-02T22:16:33.475183Z","iopub.status.idle":"2022-03-02T22:16:34.127053Z","shell.execute_reply.started":"2022-03-02T22:16:33.475152Z","shell.execute_reply":"2022-03-02T22:16:34.126064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"b.FN.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:34.129154Z","iopub.execute_input":"2022-03-02T22:16:34.129427Z","iopub.status.idle":"2022-03-02T22:16:34.140854Z","shell.execute_reply.started":"2022-03-02T22:16:34.129397Z","shell.execute_reply":"2022-03-02T22:16:34.140065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"b.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:34.141919Z","iopub.execute_input":"2022-03-02T22:16:34.142169Z","iopub.status.idle":"2022-03-02T22:16:34.790047Z","shell.execute_reply.started":"2022-03-02T22:16:34.142138Z","shell.execute_reply":"2022-03-02T22:16:34.789002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/transactions_train.csv\")\nc.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:16:34.791885Z","iopub.execute_input":"2022-03-02T22:16:34.792133Z","iopub.status.idle":"2022-03-02T22:17:54.253138Z","shell.execute_reply.started":"2022-03-02T22:16:34.792105Z","shell.execute_reply":"2022-03-02T22:17:54.252183Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c.sales_channel_id.unique()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:17:54.254607Z","iopub.execute_input":"2022-03-02T22:17:54.254867Z","iopub.status.idle":"2022-03-02T22:17:54.441972Z","shell.execute_reply.started":"2022-03-02T22:17:54.254835Z","shell.execute_reply":"2022-03-02T22:17:54.440964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:17:54.443663Z","iopub.execute_input":"2022-03-02T22:17:54.444616Z","iopub.status.idle":"2022-03-02T22:18:01.393675Z","shell.execute_reply.started":"2022-03-02T22:17:54.444563Z","shell.execute_reply":"2022-03-02T22:18:01.393039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c.info()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.394900Z","iopub.execute_input":"2022-03-02T22:18:01.395827Z","iopub.status.idle":"2022-03-02T22:18:01.407778Z","shell.execute_reply.started":"2022-03-02T22:18:01.395790Z","shell.execute_reply":"2022-03-02T22:18:01.406786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"price_more_than_two = c[c[\"price\"]>0.20]","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.409449Z","iopub.execute_input":"2022-03-02T22:18:01.410548Z","iopub.status.idle":"2022-03-02T22:18:01.519101Z","shell.execute_reply.started":"2022-03-02T22:18:01.410479Z","shell.execute_reply":"2022-03-02T22:18:01.518082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(price_more_than_two.head())","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.520773Z","iopub.execute_input":"2022-03-02T22:18:01.521024Z","iopub.status.idle":"2022-03-02T22:18:01.529750Z","shell.execute_reply.started":"2022-03-02T22:18:01.520992Z","shell.execute_reply":"2022-03-02T22:18:01.528772Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cp = c[[\"t_dat\",\"price\"]]","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.531291Z","iopub.execute_input":"2022-03-02T22:18:01.531676Z","iopub.status.idle":"2022-03-02T22:18:01.977462Z","shell.execute_reply.started":"2022-03-02T22:18:01.531630Z","shell.execute_reply":"2022-03-02T22:18:01.976516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cp.head()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.978864Z","iopub.execute_input":"2022-03-02T22:18:01.979117Z","iopub.status.idle":"2022-03-02T22:18:01.991632Z","shell.execute_reply.started":"2022-03-02T22:18:01.979085Z","shell.execute_reply":"2022-03-02T22:18:01.990539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import skimage\nfrom skimage.io import imread_collection, imshow_collection, imread, imshow\nimport os","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:01.993401Z","iopub.execute_input":"2022-03-02T22:18:01.994577Z","iopub.status.idle":"2022-03-02T22:18:02.216821Z","shell.execute_reply.started":"2022-03-02T22:18:01.994532Z","shell.execute_reply":"2022-03-02T22:18:02.215889Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"im_dirs = \"../input/h-and-m-personalized-fashion-recommendations/images/\"","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:02.218221Z","iopub.execute_input":"2022-03-02T22:18:02.218857Z","iopub.status.idle":"2022-03-02T22:18:02.223406Z","shell.execute_reply.started":"2022-03-02T22:18:02.218812Z","shell.execute_reply":"2022-03-02T22:18:02.222316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.listdir(im_dirs)[0:10]","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:02.224807Z","iopub.execute_input":"2022-03-02T22:18:02.225151Z","iopub.status.idle":"2022-03-02T22:18:02.254023Z","shell.execute_reply.started":"2022-03-02T22:18:02.225101Z","shell.execute_reply":"2022-03-02T22:18:02.253245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"load_pattern = os.path.join(\n    \"../input/h-and-m-personalized-fashion-recommendations/images/070\", \"*.jpg\"\n)","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:02.255183Z","iopub.execute_input":"2022-03-02T22:18:02.256011Z","iopub.status.idle":"2022-03-02T22:18:02.260248Z","shell.execute_reply.started":"2022-03-02T22:18:02.255957Z","shell.execute_reply":"2022-03-02T22:18:02.259360Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"images = imread_collection(\n    load_pattern=load_pattern,\n    conserve_memory=True,\n)","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:02.261500Z","iopub.execute_input":"2022-03-02T22:18:02.261827Z","iopub.status.idle":"2022-03-02T22:18:02.502964Z","shell.execute_reply.started":"2022-03-02T22:18:02.261797Z","shell.execute_reply":"2022-03-02T22:18:02.502002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(images.files)","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:02.504624Z","iopub.execute_input":"2022-03-02T22:18:02.504969Z","iopub.status.idle":"2022-03-02T22:18:02.512100Z","shell.execute_reply.started":"2022-03-02T22:18:02.504919Z","shell.execute_reply":"2022-03-02T22:18:02.511326Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imshow(*[i for i in images.files if \"0706016003\" in i])","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:18:57.867349Z","iopub.execute_input":"2022-03-02T22:18:57.868399Z","iopub.status.idle":"2022-03-02T22:18:58.311896Z","shell.execute_reply.started":"2022-03-02T22:18:57.868336Z","shell.execute_reply":"2022-03-02T22:18:58.310702Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imshow(*[i for i in images.files if \"0700109003\" in i])","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:19:58.844672Z","iopub.execute_input":"2022-03-02T22:19:58.845066Z","iopub.status.idle":"2022-03-02T22:19:59.305477Z","shell.execute_reply.started":"2022-03-02T22:19:58.845030Z","shell.execute_reply":"2022-03-02T22:19:59.304533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imshow(*[i for i in images.files if \"0700124001\" in i])","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:20:38.468642Z","iopub.execute_input":"2022-03-02T22:20:38.469584Z","iopub.status.idle":"2022-03-02T22:20:38.919935Z","shell.execute_reply.started":"2022-03-02T22:20:38.469533Z","shell.execute_reply":"2022-03-02T22:20:38.919080Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = a.groupby([\"garment_group_name\"])[\"product_type_name\"].nunique()\ndf = pd.DataFrame({\"Garment Group\": temp.index, \"Product Types\": temp.values})\ndf = df.sort_values([\"Product Types\"], ascending=False)\nplt.figure(figsize=(16, 5))\nplt.title(\"Number of Product Types each Garment Group\")\ns = sns.barplot(x=\"Garment Group\", y=\"Product Types\", data=df, palette=\"cubehelix\")\ns.set_xticklabels(s.get_xticklabels(), rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:20:43.856030Z","iopub.execute_input":"2022-03-02T22:20:43.856735Z","iopub.status.idle":"2022-03-02T22:20:44.271881Z","shell.execute_reply.started":"2022-03-02T22:20:43.856660Z","shell.execute_reply":"2022-03-02T22:20:44.270919Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = c.groupby([\"t_dat\"])[\"price\"].nunique()\ndf = pd.DataFrame({\"t_dat\": temp.index, \"price\": temp.values})\ndf = df.sort_values([\"price\"], ascending=False)\nplt.figure(figsize=(20, 10))\nplt.title(\"prices at different dates\")\ns = sns.barplot(x=\"t_dat\", y=\"price\", data=df, palette=\"cubehelix\")\ns.set_xticklabels(s.get_xticklabels(), rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-03-02T22:26:19.698316Z","iopub.execute_input":"2022-03-02T22:26:19.699507Z","iopub.status.idle":"2022-03-02T22:26:41.290816Z","shell.execute_reply.started":"2022-03-02T22:26:19.699447Z","shell.execute_reply":"2022-03-02T22:26:41.290144Z"},"trusted":true},"execution_count":null,"outputs":[]}]}