Data-Driven Customer Segmentation: Empowering Sales and Marketing Teams
Requirement
Introduction: To segment customers based on their purchasing behavior to help the sales and marketing teams target the right customer groups more effectively. The goal is to create customer segments based on their total purchase amounts and frequency of purchases.
Requirements:
Read the table 'purgo_playground.sales_data_analysis'.
Segment customers based on total spending by sum of sales amount, number of purchases for each sales Id, segments based on TotalSpend: High spender: TotalSpend >= 25000, Medium spender: 15000<= TotalSpend < 25000, Low spender: TotalSpend < 15000.
Final Output: Show the result of Customer ID, total spend, number of purchases, customer segment.
Write the pyspark code without syntax error.
Unity Catalog Details: 'purgo_playground.sales_data_analysis'