Lesson 4: Customer Insights Based on Revenue
Customer-level analysis helps identify which customers contribute the most to overall revenue. This is important for understanding customer value and prioritizing key accounts.
Code:
# Analyze revenue by deal size
top_customers = df.groupby('CUSTOMERNAME')['SALES'].sum().reset_index().sort_values(by='SALES', ascending=False).head(10)
top_customers
plt.figure(figsize=(5,2))
sns.barplot(
data=top_customers,
x='CUSTOMERNAME',
y='SALES'
)
plt.title("Top 10 Customers by Revenue")
plt.xticks(rotation=75)
plt.ylabel("Total Sales")
plt.show()
Insights:
The chart highlights the top revenue-generating customers. It shows that a small number of customers often account for a large share of sales. This insight is useful for customer retention strategies, targeted marketing, and relationship management.










