└── AMAZON SALES REPORT.py /AMAZON SALES REPORT.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[16]: 5 | 6 | 7 | import pandas as pd 8 | import matplotlib.pyplot as plt 9 | 10 | # Load the dataset 11 | ecommerce_data = pd.read_csv('Amazon Sale Report.csv') 12 | 13 | # Display the first few rows of the dataset 14 | print(ecommerce_data.head()) 15 | 16 | 17 | # In[11]: 18 | 19 | 20 | print(ecommerce_data.info()) # Summary information about the dataset 21 | print(ecommerce_data.describe()) 22 | 23 | 24 | # In[13]: 25 | 26 | 27 | #Check for missing values 28 | print(ecommerce_data.isnull().sum()) 29 | 30 | 31 | # In[14]: 32 | 33 | 34 | # Example 1: Sales analysis 35 | sales_by_category = ecommerce_data.groupby('Category')['Amount'].sum() 36 | print("\nSales by Category:") 37 | print(sales_by_category) 38 | 39 | 40 | # In[15]: 41 | 42 | 43 | # Visualize sales by category 44 | sales_by_category.plot(kind='bar', xlabel='Category', ylabel='Total Sales', title='Sales by Category') 45 | plt.show() 46 | 47 | 48 | # In[8]: 49 | 50 | 51 | # Example 2: Market basket analysis (dummy example, replace with actual analysis) 52 | # For demonstration purposes, let's create a histogram showing the distribution of purchase amounts 53 | plt.hist(ecommerce_data['Amount'], bins=20, color='skyblue', edgecolor='black') 54 | plt.xlabel('Purchase Amount') 55 | plt.ylabel('Frequency') 56 | plt.title('Distribution of Purchase Amounts') 57 | plt.show() 58 | 59 | 60 | # In[9]: 61 | 62 | 63 | # Example 4: Sales forecasting (dummy example, replace with actual analysis) 64 | # For demonstration purposes, let's create a line plot showing sales trend over time 65 | ecommerce_data['Date'] = pd.to_datetime(ecommerce_data['Date']) 66 | sales_over_time = ecommerce_data.groupby('Date')['Amount'].sum() 67 | print("\nSales Trend over Time:") 68 | print(sales_over_time) 69 | 70 | # Visualize sales trend over time 71 | sales_over_time.plot(kind='line', xlabel='Date', ylabel='Total Sales', title='Sales Trend over Time') 72 | plt.show() 73 | 74 | --------------------------------------------------------------------------------