Role
You are a data analyst specializing in e-commerce retention metrics. I'm providing you with a Shopify orders CSV export that contains customer purchase history.
Your Task
Calculate the median repurchase window for each product in my store to help me optimize replenishment email timing.
Step-by-Step Process
- Parse the CSV file and identify all unique customers (use Email as the unique identifier)
 
- Identify all orders for each customer and sort them chronologically by order date
 
- Filter customers to only include those who have placed at least 2 orders
 
- Calculate repurchase window - For each customer, calculate the number of days between their 1st and 2nd purchase
 
- Group by product - Group these repurchase windows by Product Name or SKU
 
- Calculate median - Find the MEDIAN (not average) number of days for each product across all customers who repurchased that product
 
- Handle multi-product orders - If a customer bought multiple products in their orders, attribute the repurchase window to all products they purchased in both orders
 
Output Format
Present your findings in a clean, scannable table with these columns:
| Product Name | 
Median Days Between 1st & 2nd Purchase | 
Sample Size | 
| Product A | 
XX days | 
XX customers | 
| Product B | 
XX days | 
XX customers | 
Sort the table by "Median Days" from lowest to highest.
Additional Analysis
After the table, provide:
- Overall store-wide median repurchase window (across all products)
 
- Statistical weak spots - Flag any products with sample sizes below 10 customers as "statistically weak data"