{"id":26418585,"url":"https://github.com/coderbiswajit24/maventoysanalytics","last_synced_at":"2025-06-29T06:32:03.634Z","repository":{"id":282824374,"uuid":"949763427","full_name":"Coderbiswajit24/MavenToysAnalytics","owner":"Coderbiswajit24","description":"MavenProfitPulse: Data-driven analysis of Maven Toys \u0026 Games to boost sales, profitability, and inventory using Pandas. Uncovers trends in performance, demand, and efficiency with actionable insights.","archived":false,"fork":false,"pushed_at":"2025-03-17T06:28:36.000Z","size":5374,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T06:31:41.755Z","etag":null,"topics":["data-visualization","dataanalysis","inventorymanagement","pandas-dataframe","profitoptimization","python3","retailanalytics"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coderbiswajit24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-17T05:16:35.000Z","updated_at":"2025-03-17T06:28:39.000Z","dependencies_parsed_at":"2025-03-17T06:42:38.957Z","dependency_job_id":null,"html_url":"https://github.com/Coderbiswajit24/MavenToysAnalytics","commit_stats":null,"previous_names":["coderbiswajit24/maventoysanalytics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Coderbiswajit24/MavenToysAnalytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderbiswajit24%2FMavenToysAnalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderbiswajit24%2FMavenToysAnalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderbiswajit24%2FMavenToysAnalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderbiswajit24%2FMavenToysAnalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coderbiswajit24","download_url":"https://codeload.github.com/Coderbiswajit24/MavenToysAnalytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderbiswajit24%2FMavenToysAnalytics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262546940,"owners_count":23327064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-visualization","dataanalysis","inventorymanagement","pandas-dataframe","profitoptimization","python3","retailanalytics"],"created_at":"2025-03-18T01:48:42.651Z","updated_at":"2025-06-29T06:32:03.626Z","avatar_url":"https://github.com/Coderbiswajit24.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/49adf32692fcb7c8cb4ca555ec8c8dfa7404148f/Maven_Toys.png)\n\n# MavenToysAnalytics\nData-driven analysis of Maven Toys \u0026amp; Games to boost sales, profitability, and inventory using Pandas. Uncovers trends in performance, demand, and efficiency with actionable insights.    #DataAnalysis #BusinessIntelligence #RetailAnalytics #InventoryManagement #Python #Pandas #SalesForecasting #ProfitOptimization\n\n# About Maven Comapny :\nMaven Toys \u0026 Games is a creative and innovative toy company dedicated to inspiring imagination and delivering joy to children and families. Known for going beyond traditional play, the company designs toys that entertain while fostering creativity. As a prominent player in the toy industry, Maven Toys operates a chain of stores, offering a diverse range of products across various categories. With a focus on expansion and data-driven decision-making, the company aims to create memorable experiences and continue growing its presence in the market.\n\n# Project Content :\n\n # 1. 🔍 Project Overview :\nMaven Toys, a retail chain specializing in toys and games, \noperates multiple stores across various cities. Despite having a wide range of \nproducts and a growing number of stores, the company is struggling \nwith inefficient inventory management, unclear sales performance \ntrends, and suboptimal profitability. The management lacks actionable \ninsights to make informed decisions about stock replenishment, product \npricing, and store performance. This has led to issues such as overstocking, \nstockouts, and missed sales opportunities, ultimately affecting the company's \nbottom line. \nThe goal of this project is to analyze sales data, inventory levels, and \nproduct performance to identify key trends, inefficiencies, and \nopportunities for improvement.\n![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/f293d5978d68cb2fcae46900eeaa311d0ac14bad/Maven%20Toys%20%26%20Games%20Business%20Problem%20Statement.pdf)\n\n # 2. 🎯 Project Objectives :\n By leveraging data-driven insights, Maven \nToys aims to:\n\n            1. Optimize inventory management to reduce overstocking and \n             stockouts. \n            2. Improve sales performance by identifying high-performing products \n             and stores. \n            3. Enhance profitability by analyzing product margins and pricing \n             strategies. \n            4. Forecast demand to better align inventory with customer needs. \n            5. Identify regional trends to tailor product offerings and marketing \n            strategies.\n![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/f293d5978d68cb2fcae46900eeaa311d0ac14bad/Maven%20Toys%20%26%20Games%20Analytical%20business%20Problems%20for%20Analysis.pdf)\n\n# 3. 🔧 Tools and Technologies :\n- **Python**: Core programming language.\n- **Pandas**: Data manipulation and analysis.\n- **Matplotlib \u0026 Seaborn**: For Data visualization.\n- **Jupyter Notebook**: Interactive analysis environment.\n\n# 4. 💾  Datasets :\n- Sales: Transaction data with units sold and dates.\n- Inventory: Stock levels by store and product.\n- Products: Cost, price, and category details.\n- Stores: City , Location and opening date information.\n- Calendar: Time-based data for trend \u0026 Time Series analysis.\n  ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/0dfa6369cf8651ba212a29830e238d8f62c48029/Datasets.zip)\n\n# 5. ℹ️ Metadata Information :\n ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/394b211aa28eee80132d392c2d1984116debfac1/Maven%20Toys%20%26%20Games%20Metadata%20document.txt)\n \n\n# 6. 🔗 Data Model :\nThe ER Diagram below illustrates the relationships between the datasets (Sales, Inventory, Products, Stores, and Calendar).\n\n![ER Diagram](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/348ba3d5699b339caadabe16001e9c1fc5b90c18/Maven%20Toys%20%26%20Games%20ER%20Diagram.png)\n*Figure: Entity-Relationship Diagram (Data Model) of Maven Toys \u0026 Games datasets.*  \n\n# 7. ⚙️ Installation :\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Coderbiswajit24/MavenToysAnalytics.git\n\n# 8. 🚀 Usage :\n- Open `Maven Toys \u0026 Games Retail Analysis.ipynb` ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/163c6b1c2d223bc66f0d14673f6dfcdf74969ede/Maven%20Toys%20%26%20Games%20Retail%20Analysis.ipynb)\nin Jupyter Notebook.\n- Run all cells to generate sales, inventory, and profitability insights.\n- View visualizations like the sales forecast chart.\n\n# 9. 📊  Results \u0026 Insights : \n # (a). Sales Performace Analysis Insights: \n #  Question 1 : What are the total sales revenue and profit generated by each store?\n\n             # Merge the 'stores' and 'sales' tables on the 'Store_ID' column using an inner join.\n             # This combines store information with sales data for each store.\n             store_sales = stores.merge(sales, how='inner', on='Store_ID')\n\n             # Merge the resulting DataFrame with the 'products' table on the 'Product_ID' column using an inner join.\n             # This adds product information (e.g., price, cost) to the sales data.\n             store_sales_revenue = store_sales.merge(products, how='inner', on='Product_ID')\n\n             # Calculate the revenue for each sale by multiplying the product price by the number of units sold.\n             # This creates a new column called 'Revenue' in the DataFrame.\n              store_sales_revenue['Revenue'] = (store_sales_revenue['Product_Price'] * store_sales_revenue['Units'])\n\n             # Calculate the profit for each sale by subtracting the total cost from the total revenue.\n             # The total cost is calculated by multiplying the product cost by the number of units sold.\n             # This creates a new column called 'Profit' in the DataFrame.\n             store_sales_revenue['Profit'] = (store_sales_revenue['Revenue'] - (store_sales_revenue['Product_Cost'] * store_sales_revenue['Units']))\n             \n             # Group the DataFrame by 'Store_Name' and calculate the total revenue for each store.\n             # The result is a new DataFrame with two columns: 'Store_Name' and the sum of 'Revenue' for each store.\n             df = store_sales_revenue.groupby('Store_Name')['Revenue'].sum().reset_index()\n             \n             # Rename the columns in the resulting DataFrame for clarity.\n             # The 'Revenue' column is renamed to 'Total_Sales_Revenue(US Dollars $)'.\n             df.columns = ['Store_Name', 'Total_Sales_Revenue(US Dollars $)']\n             \n             # Sort the DataFrame by the 'Total_Sales_Revenue(US Dollars $)' column in descending order.\n             # This shows the stores with the highest total sales revenue at the top.\n             df.sort_values(by='Total_Sales_Revenue(US Dollars $)', ascending=False)\n\n  # Visuals : For Sales Revenue\n\n           # Calculating Top 10 Stores Based on Sales Revenue\n             top_10_stores = df.sort_values(by = 'Total_Sales_Revenue(US Dollars $)' , ascending = False).head(10)\n             top_10_stores\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/0e909997588badf6c5191f1302322ad2462f3c48/Top%2010%20Stores%20Based%20On%20Sales%20Revenue(USD).png)\n\n  # For Profit :\n            # Calculate Top 10 Stores Based on Profit\n            df1 = store_sales_revenue.groupby('Store_Name')['Profit'].sum().reset_index()\n            df1.columns = ['Store_Name' , 'Total_Profit(US Dollars $)']\n            top_10_profitable_stores = df1.sort_values(by = 'Total_Profit(US Dollars $)' , ascending = False).head(10)\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/54cae88dcf5e7bfc540952c967a6dea5e9451117/Top%2010%20Stores%20Based%20On%20Profit(USD).png)\n  # Question 2 : Which products are the top-selling and least-selling across all stores based on quantity sold?\n      \n            # Merge the 'sales' and 'products' tables on the 'Product_ID' column using an inner join.\n            # This combines sales data with product information for each product sold.\n            product_sales = sales.merge(products, how='inner', on='Product_ID')\n            \n            # Group the merged DataFrame by 'Product_Name' and calculate the total units sold for each product.\n            # The result is a new DataFrame with two columns: 'Product_Name' and the sum of 'Units' sold for each product.\n            product_units_sold = product_sales.groupby('Product_Name')['Units'].sum().reset_index()\n            \n            # Rename the columns in the resulting DataFrame for clarity.\n            # The 'Units' column is renamed to 'Total_Quantity_Sold'.\n            product_units_sold.columns = ['Product_Name', 'Total_Quantity_Sold']\n            \n            # Sort the DataFrame by 'Total_Quantity_Sold' in descending order and select the top 10 products.\n            # This gives the top 10 best-selling products based on the total quantity sold.\n            top_selling_products = product_units_sold.sort_values(by='Total_Quantity_Sold', ascending=False).head(10)\n            \n            # Display the resulting DataFrame containing the top 10 best-selling products.\n            top_selling_products\n\n  # Visuals : For Top Selling Products\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/367cff8057cbcfedf2ea2e86dfbb7de212e6dd2a/Top%2010%20Best%20Seling%20Products%20Based%20On%20Quantity%20Sold.png)\n\n  # For Least Selling Products\n\n           # Calculating Least Selling Products based on Quantity Sold\n \n           least_selling_products = product_units_sold.sort_values(by = 'Total_Quantity_Sold' , ascending = False).tail(10)\n           \n           least_selling_products\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/367cff8057cbcfedf2ea2e86dfbb7de212e6dd2a/Bottom%2010%20Least%20Selling%20Products%20Based%20on%20Quantity%20Sold.png)\n\n  # Question 3 : How do sales vary by month, quarter, and year?\n\n            # Calculating  First 2022 Monthly Sales Revneue Trends\n            # Merge the 'product_sales' DataFrame with the 'date_table' DataFrame on the 'Date' column using an inner join.\n            # This combines sales data with date information (e.g., month, year) for each sale.\n            month_wise_sales = product_sales.merge(date_table, how='inner', on='Date')\n            \n            # Calculate the sales revenue for each sale by multiplying the product price by the number of units sold.\n            # This creates a new column called 'Sales_Revenue' in the DataFrame.\n            month_wise_sales['Sales_Revenue'] = (month_wise_sales['Product_Price'] * month_wise_sales['Units'])\n            \n            # Filter the data to include only sales from the year 2022, then group by 'Month_Number' and 'Month_Name'.\n            # Calculate the total sales revenue for each month in 2022.\n            month_wise_sales_revenue_2022 = month_wise_sales[month_wise_sales['Year'] == 2022].groupby(['Month_Number', 'Month_Name'])['Sales_Revenue'].sum().reset_index()\n     \n            # Rename the columns in the resulting DataFrame for clarity.\n            # The columns are renamed to 'Month_Number', 'Month_Name', and 'Total_Sales_Revenue'.\n            month_wise_sales_revenue_2022.columns = ['Month_Number', 'Month_Name', 'Total_Sales_Revenue']\n            \n            # Sort the DataFrame by 'Month_Number' to ensure the months are in chronological order.\n            month_wise_sales_revenue_2022.sort_values(by='Month_Number')\n  # --------------------------------------------------------------------------------------------------------------------------------------------------------\n\n            # Calculating 2023 Monthly Sales Revenue Trends\n\n            # Filter the 'month_wise_sales' DataFrame to include only sales from the year 2023.\n            # Then, group the filtered data by 'Month_Number' and 'Month_Name'.\n            # Calculate the total sales revenue for each month in 2023.\n            month_wise_sales_revenue_2023 = month_wise_sales[month_wise_sales['Year'] == 2023].groupby(['Month_Number', 'Month_Name'])['Sales_Revenue'].sum().reset_index()\n            \n            # Rename the columns in the resulting DataFrame for clarity.\n            # The columns are renamed to 'Month_Number', 'Month_Name', and 'Total_Sales_Revenue'.\n            month_wise_sales_revenue_2023.columns = ['Month_Number', 'Month_Name', 'Total_Sales_Revenue']\n            \n            # Sort the DataFrame by 'Month_Number' to ensure the months are in chronological order.\n            month_wise_sales_revenue_2023.sort_values(by='Month_Number')\n  # --------------------------------------------------------------------------------------------------------------------------------------------------------\n\n            # Year basis Quarterly Sales Revenue\n            # First Calculating 2022 Quarterly Sales Revenue Trend\n            quarter_wise_sales_revenue_2022 = month_wise_sales[month_wise_sales['Year'] == 2022].groupby(\"Quarter\")['Sales_Revenue'].sum().reset_index()\n\n            quarter_wise_sales_revenue_2022.columns = ['Quarter' , 'Total_Sales_Revenue']  \n\n            quarter_wise_sales_revenue_2022\n  # -------------------------------------------------------------------------------------------------------------------------------------------------------- \n            #  Similarly Calculate 2023 Quarterly Sales Revenue Trend\n            quarter_wise_sales_revenue_2023 = month_wise_sales[month_wise_sales['Year'] == 2023].groupby(\"Quarter\")['Sales_Revenue'].sum().reset_index \n            quarter_wise_sales_revenue_2023.columns = ['Quarter' , 'Total_Sales_Revenue']  \n            quarter_wise_sales_revenue_2023\n\n  # -------------------------------------------------------------------------------------------------------------------------------------------------------- \n           # Findout Yearly Sales Revenue and Profit trend\n           sales_revenue_2022 = sum(product_sales[product_sales['Date'] \u003c= '2022-12-31']['Sales_Revenue'])  \n           profit_2022 = sum(product_sales[product_sales['Date'] \u003c= '2022-12-31']['Profit'])\n           sales_revenue_2023 = sum(product_sales[product_sales['Date'] \u003e= '2023-01-01']['Sales_Revenue'])\n           profit_2023 = sum(product_sales[product_sales['Date'] \u003e= '2023-01-01']['Profit'])\n\n\n  # Visuals : For Monthly Sales Trend (2022 vs 2023)\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/41b0de787047b7dbba75518825fc677b4dc6f2b0/Monthly%20Sales%20Trends%20(2022%20vs%202023).png)\n  # For Quarterly Sales Trend (2022 vs 2023)\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/1f93fb8e23ab04bee503c028366ae68ea7a754b4/Quarterly%20Sales%20Trends%20%20(2022%20%26%202023).png)\n  # For Yearly Sales Revenue Trend (2022 vs 2023)\n![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/96b587be137a81439a934db8299038b0c94bbbd9/Yearly%20Sales%20Revenue%20%26%20Profit%20Comparison%20(2022%20%26%202023).png)\n  # Question 4 :  Identify Popular Products Category based on quantity Sold\n            \n            category_wise_quantity_sold = product_sales.groupby('Product_Category')['Units'].sum().reset_index()\n            category_wise_quantity_sold.columns = ['Product_Category','Total_unit_sold']\n            category_wise_quantity_sold.sort_values(by = 'Total_unit_sold' , ascending = False)\n  # Visuals :\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/36d10f6ef037ba5fba3404de8df3eb2bc494fa3c/Quantity%20Sold%20Distribution%20Of%20Products%20Category.png)\n  # (b). Inventory Management Analysis Insights: \n\n  # Question 1:  Which products are overstocked or understocked in each store? \n            # Define thresholds\n            # For example, let's assume:\n            # - Understocked: Stock_On_Hand \u003c 5\n            # - Overstocked: Stock_On_Hand \u003e 50\n            # First Calculating Understocked Products Across all stores\n            understock_threshold = 5\n            overstock_threshold = 50\n            \n            inventory['Understocked'] = inventory['Stock_On_Hand'] \u003c understock_threshold\n            \n            inventory['Overstocked'] = inventory['Stock_On_Hand'] \u003e overstock_threshold\n            \n            store_inventory = stores.merge(inventory , how = 'inner',on = 'Store_ID')\n            \n            store_product_inventory = store_inventory.merge(products , how = 'inner',on = 'Product_ID')\n            \n            store_wise_understocked_products = store_product_inventory[store_product_inventory['Understocked']][['Store_Name' , 'Product_Name','Stock_On_Hand']]\n            \n            store_wise_understocked_products.sort_values(by = ['Store_Name' , 'Product_Name'])\n            \n   #--------------------------------------------------------------------------------------------------------------------------------------------------------\n   \n           # Similarly Calculating Overstocked Products Across All stores \n           store_wise_overstocked_products = store_product_inventory[store_product_inventory['Overstocked']][['Store_Name','Product_Name','Stock_On_Hand']]\n\n           store_wise_overstocked_products.sort_values(by = ['Store_Name' , 'Product_Name'])\n\n  # Question 2 :  What is the inventory turnover rate for each product category? \n\n           # Merge sales and products to get product cost\n           sales_with_cost = pd.merge(sales, products, on='Product_ID', how='left')\n           \n           # Calculate COGS for each sale\n           sales_with_cost['COGS'] = sales_with_cost['Product_Cost'] * sales_with_cost['Units']\n           \n           # Sum COGS by product category\n           total_cogs = sales_with_cost.groupby('Product_Category')['COGS'].sum().reset_index()\n           total_cogs.columns = ['Product_Category', 'Total_COGS']\n           \n           # Merge inventory and products to get product category\n           inventory_with_category = pd.merge(inventory, products, how='inner', on='Product_ID')\n           \n           # Calculate average inventory for each product category\n           average_inventory = inventory_with_category.groupby('Product_Category')['Stock_On_Hand'].mean().reset_index()\n           average_inventory.columns = ['Product_Category', 'Average_inventory']\n           \n           # Merge total COGS and average inventory\n           turnover_rate = pd.merge(total_cogs, average_inventory, how='inner', on='Product_Category')\n           \n           # Calculate inventory turnover rate\n           turnover_rate['Inventory_Turnover_Rate'] = round(turnover_rate['Total_COGS'] / turnover_rate['Average_inventory'] , 1)\n           \n           # Display the result\n           turnover_rate[['Product_Category', 'Inventory_Turnover_Rate']]\n\n  # Visual : \n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/06e8ead7385d7872063688df9136f8537d30fc3e/Inventory%20Trunover%20Ratio%20Distribution%20on%20Products%20Category.png)\n\n  # Question 3:  Are there any products that are consistently out of stock, leading to potential lost sales? \n\n          product_sold = product_sales.groupby(['Product_ID','Product_Name'])['Units'].sum().reset_index()\n\n          product_sold.columns = ['Product_ID','Product_Name' , 'Total_Units_Sold']\n          \n          product_stock = inventory.groupby('Product_ID')['Stock_On_Hand'].mean().reset_index()\n          \n          product_stock.columns = ['Product_ID','Average_Stock']\n          \n          product_stock['Average_Stock'] = round(product_stock['Average_Stock'] , 0)\n          \n          merge_df = pd.merge(product_sold , product_stock , how = 'inner' , on = 'Product_ID')\n          \n          merge_df[merge_df['Average_Stock'] \u003c 5].sort_values(by = 'Total_Units_Sold' , ascending = False)\n\n  # Question 4 :  How does the stock-on-hand level correlate with sales performance? \n\n         correlation = merge_df['Total_Units_Sold'].corr(merge_df['Average_Stock'])\n         \n         print(\"Hence Required correlation Between Stock_On_Hand and Products Sales/Units Sold is : \",round(correlation , 1))\n\n  # Question 5 : Which stores have the best and worst inventory management practices?\n\n          store_wise_product_sold = sales.groupby('Store_ID')['Units'].sum().reset_index()\n\n          store_wise_product_sold.columns = ['Store_ID' , 'Total_Units_Sold']\n          \n          store_wise_inventory = inventory.groupby('Store_ID')['Stock_On_Hand'].sum().reset_index()\n          \n          store_wise_inventory.columns = ['Store_ID','Total_Stock']\n          \n          store_metrics = pd.merge(store_wise_product_sold,store_wise_inventory , how = 'inner',on ='Store_ID')\n          \n          store_metrics = pd.merge(store_metrics , stores , how = 'inner' , on = 'Store_ID')\n          \n          store_metrics['Inventory_Turnover_Ratio'] = round(store_metrics['Total_Units_Sold'] / store_metrics['Total_Stock'] , 0)\n          \n          stockout_frequency = inventory[inventory['Stock_On_Hand'] == 0].groupby('Store_ID').size().reset_index()\n          \n          stockout_frequency.columns = ['Store_ID','Stockout_Frequency']\n          \n          store_metrics = pd.merge(store_metrics , stockout_frequency, how = 'inner' , on = 'Store_ID')\n          \n          # Best stores: High Inventory turnover Ratio  \u0026 low stockout frequency\n          \n          store_metrics['Rank'] = store_metrics['Inventory_Turnover_Ratio'].rank(ascending=False) + store_metrics['Stockout_Frequency'].rank(ascending=True)\n\n          store_metrics[['Store_Name' , 'Total_Units_Sold' , 'Total_Stock','Inventory_Turnover_Ratio','Stockout_Frequency','Rank']].sort_values(by = 'Rank')\n\n  #--------------------------------------------------------------------------------------------------------------------------------------------------------\n\n          print(\"Best Performance Stores are: \")\n          store_metrics[['Store_Name' , \n          'Total_Units_Sold' ,\n          'Total_Stock',\n          'Inventory_Turnover_Ratio',\n          'Stockout_Frequency',\n          'Rank']].sort_values(by = 'Rank').head(5)\n\n  #--------------------------------------------------------------------------------------------------------------------------------------------------------\n  \n          print(\"Low Performance Stores are: \")\n          store_metrics[['Store_Name' , \n               'Total_Units_Sold' ,\n               'Total_Stock',\n               'Inventory_Turnover_Ratio',\n               'Stockout_Frequency',\n               'Rank']].sort_values(by = 'Rank').tail(5)  \n\n  #--------------------------------------------------------------------------------------------------------------------------------------------------------\n            \n  # (c). Product Profitability Analysis Insights : \n  # Question 1: Which product categories contribute the most to overall profitability?\n\n         product_sales['Profit'] = (product_sales['Product_Price'] - product_sales['Product_Cost'])* product_sales['Units']\n\n         product_category_wise_profit = product_sales.groupby('Product_Category')['Profit'].sum().reset_index()\n\n         product_category_wise_profit.columns = ['Product_Category','Total_Profit']\n         \n         product_category_wise_profit['Overall_profit(%)'] = round((product_category_wise_profit['Total_Profit']*100)/sum(product_sales['Profit']) , 1)\n         \n         product_category_wise_profit.sort_values(by ='Total_Profit' , ascending = False)\n   # Visual : \n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/559ba51d1b88dbd85ad4088548da156ca2a4c8e8/Profit%20Analysis%20Based%20on%20Products%20Category.png)\n  # Question 2 :  Which products have the highest and lowest profit margins?\n\n         product_profit = product_sales.groupby(['Product_ID' , 'Product_Name'])['Profit'].sum().reset_index()\n\n         product_profit.columns = ['Product_ID' , 'Product_Name' , 'Total_Profit']\n\n         product_profit.sort_values(by = 'Total_Profit' , ascending = False)\n  #--------------------------------------------------------------------------------------------------------------------------------------------------------\n\n         print(\"Highest Profit Margin or Highest Profitable Products are : \")\n\n         product_profit.sort_values(by = 'Total_Profit' , ascending = False).head(5)\n   # Visual : Top 5 Products Based on Profit\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/bf58490a7d4cceb69db6b0b14258ff3a6bda5549/Top%205%20Products%20Based%20on%20Profit.png)       \n\n  #--------------------------------------------------------------------------------------------------------------------------------------------------------\n  \n         print(\"Lowest Profit Margin or Lowest Profitable Products are: \")\n\n         product_profit.sort_values(by = 'Total_Profit' , ascending = True).head(5)\n        \n   # Bottom 5 Products Based on Profit\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/bf58490a7d4cceb69db6b0b14258ff3a6bda5549/Bottom%205%20Products%20Based%20On%20Profit.png)\n\n  # Question 3 : Are there any products that are sold at a loss (i.e., selling price is less than cost)? \n\n         print(\"Products With selling Price is less than Cost Price: \")\n\n         products[products['Product_Price'] \u003c products['Product_Cost']]\n\n   # (d). Geographical Analysis Insights :  \n   # Question 1 : How do sales and inventory levels vary across different cities and store locations? \n         # Firstly Findout Sales and Inventory levels across different store cities.\n\n          store_product_sales = pd.merge(store_sales , products , how = 'inner' , on ='Product_ID')\n          \n          store_product_sales['Sales_Revenue'] = store_product_sales['Product_Price']* store_product_sales['Units']\n          \n          store_city_wise_sales_revenue = store_product_sales.groupby('Store_City')['Sales_Revenue'].sum().reset_index()\n          \n          store_city_wise_sales_revenue.columns = ['Store_City' , 'Total_Sales_Revenue(US Dollar $)']\n          \n          store_city_wise_sales_revenue.sort_values(by = 'Total_Sales_Revenue(US Dollar $)' , ascending = False)\n   #------------------------------------------------------------------------------------------------------------------------------------------------------ \n \n          # Sort by Total_Sales_Revenue and get top 10\n          top_10_sales = store_city_wise_sales_revenue.sort_values(by='Total_Sales_Revenue(US Dollar $)', ascending=False).head(10)\n\n   # Visual : Top 10 Stores Cities Based on Sales Revenue\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/fb8523bb656bfa070f37b0a728712cb6ed99221f/Top%2010%20Stores%20Cities%20Based%20on%20Sales%20Revenue(USD).png)\n\n   #--------------------------------------------------------------------------------------------------------------------------------------------------------\n   \n          # Secondly Findout Sales and Inventory levels across different store Locations.\n\n           store_location_wise_sales_revenue = store_product_sales.groupby(\"Store_Location\")['Sales_Revenue'].sum().reset_index()\n\n           store_location_wise_sales_revenue.columns = ['Store_Location' , 'Total_Sales_Revenue(US Dollar $)']\n           \n           store_location_wise_sales_revenue['Overall_Sales_Revenue(%)'] =round((store_location_wise_sales_revenue['Total_Sales_Revenue(US Dollar $)']*100)/ sum(store_location_wise_sales_revenue['Total_Sales_Revenue(US Dollar $)']),1)\n           \n           store_location_wise_sales_revenue.sort_values(by = 'Total_Sales_Revenue(US Dollar $)' , ascending = False)\n\n   # Visual : Sales Distribution Based on Stores Locations\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/fb8523bb656bfa070f37b0a728712cb6ed99221f/Sales%20Revenue(USD)%20distribution%20on%20stores%20locations.png)\n\n   # Question 2 :  Are there any regional preferences for specific product categories? \n\n          # Firstly Findout Store city wise product category sales revenue \n\n          regional_category_preferences = store_product_sales.groupby(['Store_City' , 'Product_Category'])['Sales_Revenue'].sum().reset_index()\n\n          regional_category_preferences.columns = ['Store_City','Product_Category','Total_Sales_Revenue(US Dollar $)']\n           \n          regional_category_preferences.sort_values(by =['Store_City','Total_Sales_Revenue(US Dollar $)'],ascending =[True , False])\n\n   #----------------------------------------------------------------------------------------------------------------------------------------------------------\n\n          # Secondly Findout store Location wise product category sales revenue.\n\n          location_catgory_preferences = store_product_sales.groupby(['Store_Location','Product_Category'])['Sales_Revenue'].sum().reset_index()\n          \n          location_catgory_preferences.columns = ['Store_Location' , 'Product_Category' , 'Total_Sales_Revenue(US Dollar $)']\n          \n          location_catgory_preferences.sort_values(by = ['Store_Location' , 'Total_Sales_Revenue(US Dollar $)'] , ascending = [True , False])\n\n\n   # Question 3:   Which city or store location generates the highest revenue and profit? \n\n          # Firstly Findout Store Location wise Profit\n\n          store_product_sales['Profit'] = (store_product_sales['Product_Price'] - store_product_sales['Product_Cost'])* store_product_sales['Units']\n\n          store_location_wise_profit = store_product_sales.groupby('Store_Location')['Profit'].sum().reset_index()\n\n          store_location_wise_profit.columns = ['Store_Location' , 'Total_Profit(US Dollar $)']\n\n          store_location_wise_profit.sort_values(by = 'Total_Profit(US Dollar $)' , ascending = False) \n\n   # Visual : \n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/4f02802a6604d148772c928cdbb5115470245ad3/Store%20Location%20Wise%20Profit.png)\n\n   #----------------------------------------------------------------------------------------------------------------------------------------------------------\n\n          # Secondly Findout Store City wise Profit\n\n          store_city_wise_profit = store_product_sales.groupby('Store_City')['Profit'].sum().reset_index()\n\n          store_city_wise_profit.columns = ['Store_City' , 'Total_Profit(US Dollar $)']\n          \n          store_city_wise_profit.sort_values(by = 'Total_Profit(US Dollar $)' , ascending = False)\n   #-----------------------------------------------------------------------------------------------------------------------------------------------------------\n   \n          # Select the top 10 cities\n          top_10_cities = store_city_wise_profit.sort_values(by='Total_Profit(US Dollar $)', ascending=False).head(10)\n\n   # Visual : Top 10 Stores Cities Based on Profit\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/b520452f0f9f8e65effadc891abad21fbd94da0d/Top%2010%20Stores%20Cities%20Based%20on%20Profit.png)\n\n   # (e). Customer Demand \u0026 forecasting analysis Insights :\n   # Question 1: What are the peak sales periods (e.g., holidays, weekends)? \n\n           def findout_week_day_type(week_day):\n               if week_day =='Saturday' or week_day =='Sunday':\n                   return 'Weekends'\n               else:\n                   return 'Weekdays'\n               \n           # Add Another Column week_day_type in the date_table dataframe\n           \n           date_table['Week_Day_Type'] = date_table['Week_day'].apply(findout_week_day_type)\n           \n           date_table  \n\n   #---------------------------------------------------------------------------------------------------------------------------------------------------------\n\n           product_sales['Sales_Revenue'] = product_sales['Product_Price'] * product_sales['Units']\n\n           sales_period = pd.merge(product_sales , date_table , how = 'inner' ,on = 'Date')\n           \n           peak_sales_period = sales_period.groupby('Week_Day_Type')['Sales_Revenue'].sum().reset_index()\n           \n           peak_sales_period.columns = ['Week_Day_Type','Total_Sales_Revenue(US Dollar $)']\n           \n           peak_sales_period.sort_values(by = 'Total_Sales_Revenue(US Dollar $)' , ascending = False) \n   #---------------------------------------------------------------------------------------------------------------------------------------------------------       \n   \n           #  Peak Sales Period Based on Every Single Weekday \n\n           peak_sales_period_weekday = sales_period.groupby('Week_day')['Sales_Revenue'].sum().reset_index()\n\n           peak_sales_period_weekday.columns = ['Week_day','Total_Sales_Revenue(US Dollar $)']\n\n           peak_sales_period_weekday.sort_values(by = 'Total_Sales_Revenue(US Dollar $)' , ascending = False)\n   # Visual : Peak Sales Period by weekdays(include weekends)\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/41f2a76a347febd63e7ec4e74c673a2ecd005c19/Peak%20Sales%20Period%20based%20on%20weekdays.png)\n\n   # Question 2: Can we forecast future sales based on historical data?\n\n          from statsmodels.tsa.arima.model import ARIMA\n\n          # Fit the ARIMA model\n          # order=(p, d, q): p=autoregressive, d=differencing, q=moving average\n          # Here, we use order=(2, 1, 0) as an example. You may need to tune these parameters.\n          \n          model = ARIMA(month_wise_sales_revenue_2023['Total_Sales_Revenue'] , order = (2 , 1, 0))\n          \n          model_fit = model.fit()\n          \n          # Forecast the next 12 months\n          \n          forecast = model_fit.forecast(steps = 12)\n          \n          # Create a DataFrame for the forecasted values\n          \n          forecast_df = pd.DataFrame({'Month_Number':range(10,22),\n                                     'Forecast_Sales_Revenue':round(forecast,0)})\n          \n          \n          print(\"Forecast for Next 12 Months(from 2023 september to 2024 september): \")\n          \n          forecast_df \n\n   # Visual : Sales forecasting\n   ![Alt text](https://github.com/Coderbiswajit24/MavenToysAnalytics/blob/73994e511e8b311913d111842bed6b477ebe774e/Sales%20forecasting.png)\n\n   # Question 3 :  Are there any products that show consistent demand throughout the year?\n\n          # Findout consistence products for the year 2022\n\n          product_consistency = product_sales[product_sales['Date'] \u003c= '2022-12-31'].groupby(['Product_ID' , 'Product_Name'])['Units'].agg(Avg_unit_sold = 'mean',\n                                                                                                   StdDev_unit_sold = 'std').reset_index()\n            \n          product_consistency['Coefficient_of_Variation'] = round(product_consistency['StdDev_unit_sold'] / product_consistency['Avg_unit_sold'],1)\n            \n          # Filter products with consistent demand (Coeff_of_Variation \u003c 0.4)\n            \n          product_consistency = product_consistency[product_consistency['Coefficient_of_Variation'] \u003c 0.4]\n            \n            \n          print(\"Hence the Consistence Demanding Products for year 2022 are: \")\n            \n          product_consistency.sort_values(by = 'Coefficient_of_Variation', ascending = True)\n          \n   #------------------------------------------------------------------------------------------------------------------------------------------------------ \n\n         # Findout consistence demanding products for year 2023\n\n\n         product_consistency = product_sales[product_sales['Date'] \u003e= '2023-01-01'].groupby(['Product_ID' , 'Product_Name'])['Units'].agg(Avg_unit_sold = 'mean',\n                                                                                                StdDev_unit_sold = 'std').reset_index()\n         product_consistency['Coefficient_of_Variation'] = round(product_consistency['StdDev_unit_sold'] / product_consistency['Avg_unit_sold'],1)\n         \n         # Filter products with consistent demand (Coeff_of_Variation \u003c 0.4)\n         \n         product_consistency = product_consistency[product_consistency['Coefficient_of_Variation'] \u003c 0.4]\n         \n         print(\"Hence the Consistence Demanding Products for year 2023 are: \")\n         \n         product_consistency.sort_values(by = 'Coefficient_of_Variation' , ascending = True)  \n\n   # (f). Operational Efficiency Analysis Insights : \n\n   # Question 1: How does the store opening date impact sales performance? \n\n         store_wise_sales = store_product_sales.groupby(['Store_ID','Store_Name','Store_Open_Date'])['Sales_Revenue'].sum().reset_index()\n\n         store_wise_sales.columns = ['Store_ID','Store_Name','Store_Open_Date','Total_Sales_Revenue']\n          \n         store_wise_sales['Age'] = ((pd.to_datetime('2024-01-01') - store_wise_sales['Store_Open_Date']).dt.days // 365)\n          \n         '''\n         Calculating correlation between store age and its sales performance \n         to find the impact of store opening date in sales performance\n          \n         '''\n         correlation_result = store_wise_sales['Total_Sales_Revenue'].corr(store_wise_sales['Age'])\n          \n         print(\"Hence the Required Correlation Between Store Age and Total Sales Revenue made by each store is : \", round(correlation_result,1))\n\n   # Question 2 : Are newer stores performing better or worse than older stores? \n\n       def findout_store_type(age):\n           if age \u003c= 10:\n               return 'New_Store'\n           else:\n               return 'Old_Store'\n           \n       store_wise_sales['Store_Type'] = store_wise_sales['Age'].apply(findout_store_type) \n       \n       store_type_performance = store_wise_sales.groupby('Store_Type')['Total_Sales_Revenue'].sum().reset_index()\n       \n       store_type_performance.columns = ['Store_Type' , 'Total_Sales_Revenue']\n       \n       store_type_performance.sort_values(by = 'Total_Sales_Revenue', ascending = False)  \n\n   # 10. \u003cimg src=\"https://static.vecteezy.com/system/resources/previews/026/711/272/original/recommended-stamp-recommendation-icon-recommendation-rubber-stamp-round-band-label-emblem-seal-sticker-logo-illustration-with-grunge-texture-vector.jpg\" alt=\"Recommendation\" width=\"35\" height=\"35\"\u003e Recommendation :\n\n   # Here are Some Top Recommendations to Fulfill Business Requirements:\n   - Optimize Inventory Management:  Target stores with the lowest inventory management efficiency, such as Maven Toys Pachuca 1, Maven Toys Culiacan 1, Maven Toys La Paz 1, Maven Toys Hermosillo 2, and Maven Toys Aguascalientes 1. Leverage forecast insights to maintain optimal stock levels, minimizing overstocking of seasonal items and preventing stockouts of high-demand products like Classic Dominoes. Integrate inventory data with sales trends to prioritize fast-moving items, ensuring efficient stock management and alignment with customer demand.\n\n   - Improve Sales Performance :  Focus on top-performing stores such as Maven Toys Ciudad de Mexico 2, Maven Toys Guadalajara 3, Maven Toys Ciudad de Mexico 1, and Maven Toys Toluca 1, and prioritize promoting high-selling products like Colorbuds, PlayDoh Can, Lego Bricks, and Animal Figures. Extend the promotion of these products across all cities and key locations (e.g., downtown and commercial areas) to enhance sales performance. Additionally, launch marketing campaigns to boost the top-selling product categories—Arts \u0026 Crafts, Toys, and Games—across all stores. To optimize sales further, offer seasonal discounts during peak sales periods (summer and winter) on low-performing products such as Teddy Bears and Supersoaker Water to drive demand and improve overall sales performance.\n\n   - Enhance Profitability : To maximize profitability, implement a slight price increase for top-performing profitable products (e.g., Colorbuds, Action Figures, Lego Bricks, Deck of Cards, Glass of Marbles) and consistently in-demand products (e.g., Monopoly, Jenga, Classic Dominoes, Chutes \u0026 Ladders, Plush Pony, Mini Basketball Hoop, PlayDoh Playset, Uno Card Game). Apply this strategy across all top selling store cities and key locations (e.g., downtown and commercial areas) to boost revenue while maintaining customer demand.\n\n   - Forecast Customer Demand : Older stores (over 10 years old) generate $9.28 million in sales revenue, significantly outperforming newer stores ($5.16 million), highlighting their stronger performance over time. Peak sales occur on Thursdays, Fridays, and Saturdays, with Quarter 2 (April, May, June – summer) and Quarter 4 (November, December – winter) being the highest-performing seasons annually. To meet consistent customer demand, increase inventory stock levels of popular products such as Classic Dominoes, Chutes \u0026 Ladders, Magic Sand, Jenga, Etch A Sketch, and Uno Card Game in older stores (age \u003e 10 years). Simultaneously, reduce inventory levels of less-demanded items like Nerf Guns, Dinosaur Figures, Rubik’s Cube, and Decks of Cards across all top-selling locations (e.g., downtown and commercial areas) to optimize stock and align with consumer preferences.\n\n\n   - Regional Trends : Focus on top-selling cities such as Mexico City, Guadalajara, Monterrey, Hermosillo, Guanajuato, Puebla, Toluca, and Xalapa, and high-performing locations like downtown and commercial areas. In these regions, prioritize promoting high-demand product categories, including Toys, Arts \u0026 Crafts, and Electronic Games, to capitalize on consumer preferences. For lower-performing locations, such as airports and residential areas, tailor offerings by promoting products in the Toys, Games, and Arts \u0026 Crafts categories to boost sales and better align with regional demand.\n      \n# Thank You!\n\n![Thank You](https://th.bing.com/th/id/OIP.lsrYKH1UItL1uVP4kTv1ZQHaHa?pid=ImgDet\u0026w=474\u0026h=474\u0026rs=1)\n\nThank you for visiting and supporting my project!\n\n\nIf you'd like to refine this further or need additional details, let me know!   \n   \n\n    \n\n\n   \n           \n\n            \n\n          \n       \n              \n         \n             \n\n   \n   \n   \n                   \n \n\n\n           \n           \n\n  \n     \n     \n                           \n             \n\n            \t   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderbiswajit24%2Fmaventoysanalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderbiswajit24%2Fmaventoysanalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderbiswajit24%2Fmaventoysanalytics/lists"}