Adeena Pudeena
Introduction
The goal of this analysis is to examine sales performance across different product categories and
regions. By analyzing a small retail sales dataset, we aim to understand which products generate
the highest revenue, how regions differ in sales performance, and what patterns can guide better
business decision-making. This report covers data loading, cleaning, exploration, visualization, and
statistical analysis using Python and Pandas.
[1]: import pandas as pd
import numpy as np
import [Link] as plt
import seaborn as sns
[Link](style="whitegrid")
pd.set_option('display.max_columns', None)
print("Libraries imported.")
Libraries imported.
[2]:
<[Link] object>
Saving [Link] to [Link]
[3]: import pandas as pd
[3] : Date Product Category Units_Sold Price Revenue Region
0 2024-01-02 Laptop Electronics 5 700 3500 North
1 2024-01-03 Mouse Electronics 20 15 300 South
2 2024-01-05 Chair Furniture 8 40 320 East
3 2024-01-07 Desk Furniture 3 120 360 West
4 2024-01-10 Coffee Maker Home 6 50 300 North
1
[4] :
<[Link] object>
Saving [Link] to SalesDataset (1).csv
[5] :
[5]: Date Product Category Units_Sold Price Revenue Region
0 2024-01-02 Laptop Electronics 5 700 3500 North
1 2024-01-03 Mouse Electronics 20 15 300 South
2 2024-01-05 Chair Furniture 8 40 320 East
3 2024-01-07 Desk Furniture 3 120 360 West
4 2024-01-10 Coffee Maker Home 6 50 300 North
[6] :
<class '[Link]'>
RangeIndex: 12 entries, 0 to 11
Data columns (total 7 columns):
# Column Non-Null Count Dtype
0 Date 12 non-null object
1 Product 12 non-null object
2 Category 12 non-null object
3 Units_Sold 12 non-null int64
4 Price 12 non-null int64
5 Revenue 12 non-null int64
6 Region 12 non-null object
dtypes: int64(3), object(4)
memory usage: 804.0+ bytes
[6] : Date 0
Product 0
Category 0
Units_Sold 0
Price 0
Revenue 0
Region 0
dtype: int64
[7] :
2
<class '[Link]'>
RangeIndex: 12 entries, 0 to 11
Data columns (total 7 columns):
# Column Non-Null Count Dtype
0 Date 12 non-null datetime64[ns]
1 Product 12 non-null object
2 Category 12 non-null object
3 Units_Sold 12 non-null int64
4 Price 12 non-null int64
5 Revenue 12 non-null int64
6 Region 12 non-null object
dtypes: datetime64[ns](1), int64(3), object(3)
memory usage: 804.0+ bytes
[8] : def clean_data(df):
df = df.drop_duplicates()
df['Date'] = pd.to_datetime(df['Date'])
[Link] = [[Link]() for col in [Link]]
return df
df = clean_data(df)
[Link]()
<class '[Link]'>
RangeIndex: 12 entries, 0 to 11
Data columns (total 7 columns):
# Column Non-Null Count Dtype
0 Date 12 non-null datetime64[ns]
1 Product 12 non-null object
2 Category 12 non-null object
3 Units_Sold 12 non-null int64
4 Price 12 non-null int64
5 Revenue 12 non-null int64
6 Region 12 non-null object
dtypes: datetime64[ns](1), int64(3), object(3)
memory usage: 804.0+ bytes
[9] :
3
[Link]("Revenue Distribution")
[Link]()
[Link](figsize=(6,4))
[Link](df['Units_Sold'], kde=True)
[Link]("Units Sold Distribution")
[Link]()
4
[10] : category_rev = [Link]('Category')['Revenue'].sum().
𝗌sort_values(ascending=False)
[Link](figsize=(6,4))
[Link](x=category_rev.index, y=category_rev.values)
[Link]("Total Revenue by Category")
[Link]("Category")
[Link]("Revenue")
[Link]()
5
[11] : region_rev = [Link]('Region')['Revenue'].sum().sort_values(ascending=False)
[Link](figsize=(6,4))
[Link](x=region_rev.index, y=region_rev.values)
[Link]("Total Revenue by Region")
[Link]("Region")
[Link]("Revenue")
[Link]()
6
[12] :
7
[13] :
8
[14] : def plot_bar(df, group_col, value_col):
grouped = [Link](group_col)[value_col].sum()
[Link](figsize=(6,4))
[Link](x=[Link], y=[Link])
[Link](f"{value_col} by {group_col}")
[Link](group_col)
[Link](value_col)
[Link](rotation=45)
[Link]()
# Example usage:
plot_bar(df, "Category", "Revenue")
9
[15] : def basic_stats(df):
stats = {
"Total Revenue": df['Revenue'].sum(),
"Average Revenue": df['Revenue'].mean(),
"Average Units Sold": df['Units_Sold'].mean()
}
return stats
basic_stats(df)
[15]: {'Total Revenue': np.int64(8560),
'Average Revenue': np.float64(713.3333333333334),
'Average Units Sold': np.float64(6.5)}
1- Electronics is the highest revenue-generating category. Products like Laptops, Monitors, and
Keyboards contribute a large portion of total revenue.
2- Furniture has fewer units sold but high-value items, such as Sofas and Beds, which create strong
revenue from single transactions.
3- North and South regions show strong performance, driven mainly by Electronics and essential
10
household items.
4- There is a direct positive correlation between Units Sold and Revenue, as shown in the scatter
plot — higher quantity directly increases earnings.
5- Pricing significantly affects revenue, since high-priced products like Laptops and Sofas create
noticeable spikes in revenue compared to low-priced products.
Conclusion
This data analysis helped identify the most profitable categories and regions for the sales dataset.
Electronics and Furniture emerged as top-performing categories, while North and South regions
showed strong revenue contributions. The relationship between price, units sold, and revenue was
clear, confirming that product pricing and demand greatly influence total earnings. These insights
can help guide future decisions related to product planning, pricing strategies, and inventory management.
11