Segment Data Into Meaningful Groups
Describe what each row represents, the columns most relevant for grouping, and the business decisions the segments should inform, and this prompt finds meaningful groups three ways at once. It runs rule-based segmentation from business logic, statistical clustering with an optimal K, and behavioral (recency/frequency/monetary) segmentation where time-series data exists, then profiles each segment, names it in plain language, and pairs it with one actionable recommendation plus the Python code behind it.
Segment my dataset into meaningful groups: Dataset: {row_description} Key columns: {segmentation_columns} Business context: {business_context} Carry out: 1. Rule-based segmentation from business logic (e.g., high/medium/low value customers by revenue) 2. Statistical segmentation via clustering (K-means or similar, with optimal K determined) 3. Behavioral segmentation if time-series data exists (frequency, recency, monetary value) 4. A profile of each segment: size, key traits, and how it differs from the overall population 5. A descriptive name for each segment that a non-technical stakeholder would grasp 6. One actionable business recommendation per segment Provide Python code for both segmentation and profiling.