📊

Customer Classifier

Automatically categorize customers based on purchase history or custom rules.

Excel ⭐⭐ Intermediate ⏱️ 5 minutes

😫 The Pain Point

You have 10,000 customers and need to segment them by purchase frequency. VIP (>10 orders), Regular (3-10), New (1-2), Inactive (0 in 6 months). Doing this manually is error-prone.

🚀 Agentic Solution

A Rule-Based Classifier that categorizes based on your business logic.

Key Features:

  • Custom Rules: Define your own thresholds.
  • Multiple Criteria: Combine amount, frequency, recency.
  • RFM Analysis: Built-in Recency-Frequency-Monetary scoring.

⚔️ Phase 1: Commander (Quick Fix)

For quick classification.

Prompt:

“I have an Excel customers.xlsx with columns ‘Customer_ID’, ‘Order_Count’, ‘Total_Spent’, ‘Last_Order_Date’. Write a Python script using Pandas to:

  1. Classify:
    • VIP: Order_Count > 10 AND Total_Spent > 10M
    • Regular: Order_Count 3-10
    • New: Order_Count 1-2
    • Inactive: Last_Order > 6 months ago
  2. Add: New column ‘Segment’.
  3. Output: Save with segment counts summary.

Print distribution of segments.”

Result: Segmented customer list for marketing.

🏗️ Phase 2: Architect (Permanent Tool)

For Marketing Analysts.

Engineering Prompt:

**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Customer Segmentation Tool" Desktop App

**Objective:** A desktop utility to categorize customer data based on custom business rules.

**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Data Engine: Pandas
* Packaging: PyInstaller

**Functional Requirements:**
1.  **UI Layout (PyQt6):**
    *   **Data:** Excel File Input.
    *   **Rule Engine:** Dynamic list of "IF [Column] [Operator] [Value] THEN [Segment]".
    *   **Preview:** Pie Chart showing segment distribution.
    *   **Export:** "Save Tagged List" button.

2.  **Core Logic:**
    *   Construct Pandas queries from UI rule definitions.
    *   Apply segmentation logic sequentially.
    *   **Threading:** Process large datasets in background.

3.  **Deliverables:**
    *   `main.py`: Complete source code.
    *   `requirements.txt`: Dependencies.
    *   **Build Instructions:**
        *   Windows: `pyinstaller --onefile --noconsole main.py`
        *   macOS: `pyinstaller --windowed --noconsole main.py`

🧠 Prompt Decoding

  • RFM Analysis: Recency (when), Frequency (how often), Monetary (how much) - standard marketing segmentation.

🛠️ Instructions

  1. Copy Prompt → Adjust thresholds → Run.

Related Workflows

Explore other categories

📬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

📖 Free eBook Guide 📦 7 Ready-to-use Scripts 🔔 Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.