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

  1. Parse the CSV file and identify all unique customers (use Email as the unique identifier)
  2. Identify all orders for each customer and sort them chronologically by order date
  3. Filter customers to only include those who have placed at least 2 orders
  4. Calculate repurchase window - For each customer, calculate the number of days between their 1st and 2nd purchase
  5. Group by product - Group these repurchase windows by Product Name or SKU
  6. Calculate median - Find the MEDIAN (not average) number of days for each product across all customers who repurchased that product
  7. 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: