{"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\n# import os\n# for 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":"2022-02-24T17:37:25.591917Z","iopub.execute_input":"2022-02-24T17:37:25.592751Z","iopub.status.idle":"2022-02-24T17:37:25.624170Z","shell.execute_reply.started":"2022-02-24T17:37:25.592589Z","shell.execute_reply":"2022-02-24T17:37:25.623005Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt\nimport plotly.express as px","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:37:25.625957Z","iopub.execute_input":"2022-02-24T17:37:25.626281Z","iopub.status.idle":"2022-02-24T17:37:28.256427Z","shell.execute_reply.started":"2022-02-24T17:37:25.626249Z","shell.execute_reply":"2022-02-24T17:37:28.255435Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles = pd.read_csv('/kaggle/input/h-and-m-personalized-fashion-recommendations/articles.csv')\ntransactions = pd.read_csv('/kaggle/input/h-and-m-personalized-fashion-recommendations/transactions_train.csv')\ncustomer  = pd.read_csv('/kaggle/input/h-and-m-personalized-fashion-recommendations/customers.csv')","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:37:28.257742Z","iopub.execute_input":"2022-02-24T17:37:28.257999Z","iopub.status.idle":"2022-02-24T17:38:39.253702Z","shell.execute_reply.started":"2022-02-24T17:37:28.257969Z","shell.execute_reply":"2022-02-24T17:38:39.252863Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Getting an overview of the datasets","metadata":{}},{"cell_type":"code","source":"print(articles.shape)\nprint(transactions.shape)\nprint(customer.shape)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.255500Z","iopub.execute_input":"2022-02-24T17:38:39.255893Z","iopub.status.idle":"2022-02-24T17:38:39.261530Z","shell.execute_reply.started":"2022-02-24T17:38:39.255861Z","shell.execute_reply":"2022-02-24T17:38:39.260753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.head().T","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.263065Z","iopub.execute_input":"2022-02-24T17:38:39.263328Z","iopub.status.idle":"2022-02-24T17:38:39.299173Z","shell.execute_reply.started":"2022-02-24T17:38:39.263296Z","shell.execute_reply":"2022-02-24T17:38:39.297868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions.head().T","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.300540Z","iopub.execute_input":"2022-02-24T17:38:39.300801Z","iopub.status.idle":"2022-02-24T17:38:39.314856Z","shell.execute_reply.started":"2022-02-24T17:38:39.300772Z","shell.execute_reply":"2022-02-24T17:38:39.313475Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customer.head().T","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.316448Z","iopub.execute_input":"2022-02-24T17:38:39.316784Z","iopub.status.idle":"2022-02-24T17:38:39.331980Z","shell.execute_reply.started":"2022-02-24T17:38:39.316745Z","shell.execute_reply":"2022-02-24T17:38:39.331030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Basic Exploration for each Dataset","metadata":{}},{"cell_type":"markdown","source":"# Customer Dataset","metadata":{}},{"cell_type":"code","source":"# percentage of null values in Customer Dataset\n100*customer.isnull().sum()/customer.shape[0]","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.333278Z","iopub.execute_input":"2022-02-24T17:38:39.333581Z","iopub.status.idle":"2022-02-24T17:38:39.956040Z","shell.execute_reply.started":"2022-02-24T17:38:39.333547Z","shell.execute_reply":"2022-02-24T17:38:39.955004Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Unique values in customer table (Total Rows  = 1371980)\ncustomer.nunique()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:39.957657Z","iopub.execute_input":"2022-02-24T17:38:39.958010Z","iopub.status.idle":"2022-02-24T17:38:41.676910Z","shell.execute_reply.started":"2022-02-24T17:38:39.957964Z","shell.execute_reply":"2022-02-24T17:38:41.675993Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customer['FN'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:41.679781Z","iopub.execute_input":"2022-02-24T17:38:41.680032Z","iopub.status.idle":"2022-02-24T17:38:41.705310Z","shell.execute_reply.started":"2022-02-24T17:38:41.680004Z","shell.execute_reply":"2022-02-24T17:38:41.704681Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customer['Active'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:41.706710Z","iopub.execute_input":"2022-02-24T17:38:41.706961Z","iopub.status.idle":"2022-02-24T17:38:41.729445Z","shell.execute_reply.started":"2022-02-24T17:38:41.706930Z","shell.execute_reply":"2022-02-24T17:38:41.728570Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customer['club_member_status'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:41.731016Z","iopub.execute_input":"2022-02-24T17:38:41.731310Z","iopub.status.idle":"2022-02-24T17:38:41.957013Z","shell.execute_reply.started":"2022-02-24T17:38:41.731277Z","shell.execute_reply":"2022-02-24T17:38:41.955858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customer['fashion_news_frequency'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:41.958732Z","iopub.execute_input":"2022-02-24T17:38:41.958994Z","iopub.status.idle":"2022-02-24T17:38:42.183781Z","shell.execute_reply.started":"2022-02-24T17:38:41.958953Z","shell.execute_reply":"2022-02-24T17:38:42.182886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(customer['Active'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:42.185342Z","iopub.execute_input":"2022-02-24T17:38:42.186320Z","iopub.status.idle":"2022-02-24T17:38:42.512172Z","shell.execute_reply.started":"2022-02-24T17:38:42.186261Z","shell.execute_reply":"2022-02-24T17:38:42.511145Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(customer['club_member_status'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:42.515428Z","iopub.execute_input":"2022-02-24T17:38:42.515891Z","iopub.status.idle":"2022-02-24T17:38:44.508268Z","shell.execute_reply.started":"2022-02-24T17:38:42.515829Z","shell.execute_reply":"2022-02-24T17:38:44.507533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(customer['fashion_news_frequency'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:44.509711Z","iopub.execute_input":"2022-02-24T17:38:44.510220Z","iopub.status.idle":"2022-02-24T17:38:46.366676Z","shell.execute_reply.started":"2022-02-24T17:38:44.510173Z","shell.execute_reply":"2022-02-24T17:38:46.365586Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(customer['age'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:46.368278Z","iopub.execute_input":"2022-02-24T17:38:46.368623Z","iopub.status.idle":"2022-02-24T17:38:51.878708Z","shell.execute_reply.started":"2022-02-24T17:38:46.368563Z","shell.execute_reply":"2022-02-24T17:38:51.877740Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x='club_member_status',data=customer,hue='fashion_news_frequency')\nplt.legend(bbox_to_anchor=(1.01, 1),\n           borderaxespad=0)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:51.879984Z","iopub.execute_input":"2022-02-24T17:38:51.880209Z","iopub.status.idle":"2022-02-24T17:38:55.432928Z","shell.execute_reply.started":"2022-02-24T17:38:51.880183Z","shell.execute_reply":"2022-02-24T17:38:55.431995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.catplot(x='club_member_status',y='age', data=customer)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:38:55.434254Z","iopub.execute_input":"2022-02-24T17:38:55.434515Z","iopub.status.idle":"2022-02-24T17:39:12.510922Z","shell.execute_reply.started":"2022-02-24T17:38:55.434482Z","shell.execute_reply":"2022-02-24T17:39:12.510017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.boxplot(x='club_member_status',y='age',data=customer)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:12.512069Z","iopub.execute_input":"2022-02-24T17:39:12.512304Z","iopub.status.idle":"2022-02-24T17:39:13.898648Z","shell.execute_reply.started":"2022-02-24T17:39:12.512266Z","shell.execute_reply":"2022-02-24T17:39:13.897620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(customer[customer.club_member_status == 'ACTIVE']['age'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:13.900385Z","iopub.execute_input":"2022-02-24T17:39:13.900729Z","iopub.status.idle":"2022-02-24T17:39:19.390512Z","shell.execute_reply.started":"2022-02-24T17:39:13.900684Z","shell.execute_reply":"2022-02-24T17:39:19.389710Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(customer[customer.club_member_status == 'PRE-CREATE']['age'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:19.391802Z","iopub.execute_input":"2022-02-24T17:39:19.392778Z","iopub.status.idle":"2022-02-24T17:39:20.288483Z","shell.execute_reply.started":"2022-02-24T17:39:19.392729Z","shell.execute_reply":"2022-02-24T17:39:20.287345Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(customer[customer.club_member_status == 'LEFT CLUB']['age'])","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:20.290055Z","iopub.execute_input":"2022-02-24T17:39:20.290281Z","iopub.status.idle":"2022-02-24T17:39:20.666215Z","shell.execute_reply.started":"2022-02-24T17:39:20.290254Z","shell.execute_reply":"2022-02-24T17:39:20.665255Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(customer['age'].max())\nprint(customer['age'].min())","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:20.667403Z","iopub.execute_input":"2022-02-24T17:39:20.667638Z","iopub.status.idle":"2022-02-24T17:39:20.677187Z","shell.execute_reply.started":"2022-02-24T17:39:20.667610Z","shell.execute_reply":"2022-02-24T17:39:20.676384Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Transaction Dataset","metadata":{}},{"cell_type":"code","source":"#No Null Values\n100*transactions.isnull().sum()/transactions.shape[0]","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:20.678355Z","iopub.execute_input":"2022-02-24T17:39:20.679254Z","iopub.status.idle":"2022-02-24T17:39:27.616588Z","shell.execute_reply.started":"2022-02-24T17:39:20.679197Z","shell.execute_reply":"2022-02-24T17:39:27.615589Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#unique values in transactions data set \ntransactions.nunique()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:27.617791Z","iopub.execute_input":"2022-02-24T17:39:27.618021Z","iopub.status.idle":"2022-02-24T17:39:39.378534Z","shell.execute_reply.started":"2022-02-24T17:39:27.617993Z","shell.execute_reply":"2022-02-24T17:39:39.377630Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# There are 1362281 unique customers and 104547 artcles","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:39.379906Z","iopub.execute_input":"2022-02-24T17:39:39.380135Z","iopub.status.idle":"2022-02-24T17:39:39.384270Z","shell.execute_reply.started":"2022-02-24T17:39:39.380109Z","shell.execute_reply":"2022-02-24T17:39:39.383269Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# checking for dupliacte rows  || are these really duplicated \n\ntransactions[transactions.duplicated()]","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:39:39.389029Z","iopub.execute_input":"2022-02-24T17:39:39.389305Z","iopub.status.idle":"2022-02-24T17:40:00.772757Z","shell.execute_reply.started":"2022-02-24T17:39:39.389275Z","shell.execute_reply":"2022-02-24T17:40:00.772041Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions[(transactions.t_dat == '2018-09-20') & \n             (transactions.article_id == 501820043) &\n             (transactions.customer_id == '000aa7f0dc06cd7174389e76c9e132a67860c5f65f970699daccc14425ac31a8')]","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:00.773809Z","iopub.execute_input":"2022-02-24T17:40:00.774549Z","iopub.status.idle":"2022-02-24T17:40:10.935634Z","shell.execute_reply.started":"2022-02-24T17:40:00.774517Z","shell.execute_reply":"2022-02-24T17:40:10.934650Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# its mentioned in the Description \n# Duplicate rows correspond to multiple purchases of the same item.\n","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:10.937077Z","iopub.execute_input":"2022-02-24T17:40:10.937311Z","iopub.status.idle":"2022-02-24T17:40:10.940964Z","shell.execute_reply.started":"2022-02-24T17:40:10.937285Z","shell.execute_reply":"2022-02-24T17:40:10.939740Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Top 20 Articles based on Purchase being made","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:10.942427Z","iopub.execute_input":"2022-02-24T17:40:10.942995Z","iopub.status.idle":"2022-02-24T17:40:10.961696Z","shell.execute_reply.started":"2022-02-24T17:40:10.942947Z","shell.execute_reply":"2022-02-24T17:40:10.960775Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"purchases_counts = transactions['article_id'].value_counts().reset_index()\npurchases_counts.columns = ['article_id', 'qty']","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:10.963357Z","iopub.execute_input":"2022-02-24T17:40:10.963640Z","iopub.status.idle":"2022-02-24T17:40:12.354582Z","shell.execute_reply.started":"2022-02-24T17:40:10.963582Z","shell.execute_reply":"2022-02-24T17:40:12.353846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Highly Purchased Articles","metadata":{}},{"cell_type":"code","source":"purchases_counts.head(10)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:12.355991Z","iopub.execute_input":"2022-02-24T17:40:12.356430Z","iopub.status.idle":"2022-02-24T17:40:12.366402Z","shell.execute_reply.started":"2022-02-24T17:40:12.356399Z","shell.execute_reply":"2022-02-24T17:40:12.365422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot(x = 'article_id',\n            y = 'qty',\n            data = purchases_counts.head(10))\nplt.xticks(rotation=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:12.367619Z","iopub.execute_input":"2022-02-24T17:40:12.368345Z","iopub.status.idle":"2022-02-24T17:40:12.560785Z","shell.execute_reply.started":"2022-02-24T17:40:12.368302Z","shell.execute_reply":"2022-02-24T17:40:12.559907Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  Least Purcahsed Articles","metadata":{}},{"cell_type":"code","source":"purchases_counts.tail(10)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:12.562161Z","iopub.execute_input":"2022-02-24T17:40:12.562817Z","iopub.status.idle":"2022-02-24T17:40:12.574149Z","shell.execute_reply.started":"2022-02-24T17:40:12.562768Z","shell.execute_reply":"2022-02-24T17:40:12.573436Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Top Customers Based on Items Purchased","metadata":{}},{"cell_type":"code","source":"customer_purchase_count = transactions['customer_id'].value_counts().reset_index()\ncustomer_purchase_count.columns  = ['customer_id', 'items_purchased']","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:12.575289Z","iopub.execute_input":"2022-02-24T17:40:12.576096Z","iopub.status.idle":"2022-02-24T17:40:21.359028Z","shell.execute_reply.started":"2022-02-24T17:40:12.576061Z","shell.execute_reply":"2022-02-24T17:40:21.357989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Top 10 Customers Based on Items Putchased","metadata":{}},{"cell_type":"code","source":"\nsns.barplot(x = 'customer_id',\n            y = 'items_purchased',\n            data = customer_purchase_count.head(10))\nplt.xticks(rotation=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:21.360349Z","iopub.execute_input":"2022-02-24T17:40:21.361432Z","iopub.status.idle":"2022-02-24T17:40:21.645457Z","shell.execute_reply.started":"2022-02-24T17:40:21.361385Z","shell.execute_reply":"2022-02-24T17:40:21.644537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Top 10 Customers based on Sales Amount","metadata":{}},{"cell_type":"code","source":"sales = transactions.groupby(['customer_id'])['price'].sum().reset_index()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:21.646810Z","iopub.execute_input":"2022-02-24T17:40:21.647659Z","iopub.status.idle":"2022-02-24T17:40:34.867442Z","shell.execute_reply.started":"2022-02-24T17:40:21.647575Z","shell.execute_reply":"2022-02-24T17:40:34.866412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sales.sort_values(by = 'price', ascending = False, inplace = True)\nsales.reset_index(drop=True)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:34.868773Z","iopub.execute_input":"2022-02-24T17:40:34.869021Z","iopub.status.idle":"2022-02-24T17:40:35.403037Z","shell.execute_reply.started":"2022-02-24T17:40:34.868993Z","shell.execute_reply":"2022-02-24T17:40:35.402158Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot(x = 'customer_id',\n            y = 'price',\n            data = sales.head(10))\nplt.xticks(rotation=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:35.404218Z","iopub.execute_input":"2022-02-24T17:40:35.404522Z","iopub.status.idle":"2022-02-24T17:40:35.704150Z","shell.execute_reply.started":"2022-02-24T17:40:35.404479Z","shell.execute_reply":"2022-02-24T17:40:35.703179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Top 10 Articles by Sales","metadata":{}},{"cell_type":"code","source":"sales_articles = transactions.groupby(['article_id'])['price'].sum().reset_index()\nsales_articles.sort_values(by = 'price', ascending = False, inplace = True)\nsales_articles.reset_index(drop=True)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:35.705494Z","iopub.execute_input":"2022-02-24T17:40:35.705790Z","iopub.status.idle":"2022-02-24T17:40:36.754091Z","shell.execute_reply.started":"2022-02-24T17:40:35.705748Z","shell.execute_reply":"2022-02-24T17:40:36.753277Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot(x = 'article_id',\n            y = 'price',\n            data = sales_articles.head(10))\nplt.xticks(rotation=90)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:36.755336Z","iopub.execute_input":"2022-02-24T17:40:36.755609Z","iopub.status.idle":"2022-02-24T17:40:37.003293Z","shell.execute_reply.started":"2022-02-24T17:40:36.755562Z","shell.execute_reply":"2022-02-24T17:40:37.002524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"yearly_sales = transactions.groupby(['t_dat'])['price'].sum().reset_index()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:37.004504Z","iopub.execute_input":"2022-02-24T17:40:37.004843Z","iopub.status.idle":"2022-02-24T17:40:40.190058Z","shell.execute_reply.started":"2022-02-24T17:40:37.004809Z","shell.execute_reply":"2022-02-24T17:40:40.189174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nfig = px.line(yearly_sales, x='t_dat', y='price', title='Time Series with Yearly Sales')\n\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:40.191196Z","iopub.execute_input":"2022-02-24T17:40:40.191673Z","iopub.status.idle":"2022-02-24T17:40:41.532955Z","shell.execute_reply.started":"2022-02-24T17:40:40.191641Z","shell.execute_reply":"2022-02-24T17:40:41.531821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Articles Dataset","metadata":{}},{"cell_type":"code","source":"100*articles.isnull().sum()/articles.shape[0]","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:41.534397Z","iopub.execute_input":"2022-02-24T17:40:41.534785Z","iopub.status.idle":"2022-02-24T17:40:41.705542Z","shell.execute_reply.started":"2022-02-24T17:40:41.534734Z","shell.execute_reply":"2022-02-24T17:40:41.704658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.nunique()","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:41.707076Z","iopub.execute_input":"2022-02-24T17:40:41.708010Z","iopub.status.idle":"2022-02-24T17:40:41.887010Z","shell.execute_reply.started":"2022-02-24T17:40:41.707962Z","shell.execute_reply":"2022-02-24T17:40:41.885947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:41.888090Z","iopub.execute_input":"2022-02-24T17:40:41.888318Z","iopub.status.idle":"2022-02-24T17:40:41.895038Z","shell.execute_reply.started":"2022-02-24T17:40:41.888289Z","shell.execute_reply":"2022-02-24T17:40:41.894022Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions.shape","metadata":{"execution":{"iopub.status.busy":"2022-02-24T17:40:41.897005Z","iopub.execute_input":"2022-02-24T17:40:41.897268Z","iopub.status.idle":"2022-02-24T17:40:41.907262Z","shell.execute_reply.started":"2022-02-24T17:40:41.897225Z","shell.execute_reply":"2022-02-24T17:40:41.906559Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Upvote if you Liked it!\n","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}