rfm-customer-segmentation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRFM Customer Segmentation Analysis
RFM客户细分分析
A comprehensive customer segmentation skill that automatically analyzes e-commerce transaction data to identify customer value segments using RFM (Recency, Frequency, Monetary) analysis with K-means clustering.
这是一款全面的客户细分工具,可自动分析电商交易数据,通过结合RFM(最近消费时间、消费频率、消费金额)分析与K-means聚类来识别客户价值细分群体。
Instructions
使用说明
1. Data Analysis
1. 数据分析
When users provide e-commerce data or ask about customer segmentation:
- Load and validate the transaction data
- Clean data by removing invalid orders (negative quantities, zero prices)
- Calculate RFM metrics for each customer:
- Recency: Days since last purchase
- Frequency: Number of purchases
- Monetary: Total purchase amount
- Use K-means clustering on RFM dimensions
- Automatically determine optimal number of clusters using elbow method
当用户提供电商数据或咨询客户细分相关问题时:
- 加载并验证交易数据
- 清理数据,移除无效订单(如负数量、零价格订单)
- 为每位客户计算RFM指标:
- Recency(最近消费时间):距离上次购买的天数
- Frequency(消费频率):购买次数
- Monetary(消费金额):总购买金额
- 在RFM维度上应用K-means聚类
- 使用肘部法则自动确定最优聚类数量
2. Customer Segmentation
2. 客户细分
- Create customer value segments: High, Medium, Low value customers
- Score each customer on RFM dimensions (1-3 scale)
- Calculate overall customer value scores
- Identify and rank VIP customers for marketing campaigns
- 创建客户价值细分群体:高价值、中价值、低价值客户
- 为每位客户在RFM维度上打分(1-3分制)
- 计算客户整体价值得分
- 识别并排序VIP客户,用于营销活动
3. Visualization and Reporting
3. 可视化与报告
- Generate comprehensive customer segmentation dashboard
- Create pie charts for segment distribution and revenue share
- Build RFM scatter plots to visualize customer patterns
- Generate box plots showing value distribution by segment
- Export detailed CSV reports with VIP customer lists
- 生成全面的客户细分仪表盘
- 创建细分群体分布与收入占比的饼图
- 构建RFM散点图以可视化客户模式
- 生成按细分群体展示价值分布的箱线图
- 导出包含VIP客户列表的详细CSV报告
4. Marketing Insights
4. 营销洞察
- Provide actionable marketing recommendations for each segment
- Generate executive summary with key findings
- Create customer activation strategies for different value tiers
- Export VIP customer lists for targeted marketing campaigns
- 为每个细分群体提供可执行的营销建议
- 生成包含关键发现的执行摘要
- 为不同价值层级的客户制定激活策略
- 导出VIP客户列表用于精准营销活动
Usage Examples
使用示例
Basic Customer Segmentation
基础客户细分
Analyze these e-commerce orders and segment customers by value:
[CSV data with order_id, user_id, purchase_date, quantity, unit_price]分析以下电商订单并按价值细分客户:
[包含order_id、user_id、purchase_date、quantity、unit_price的CSV数据]VIP Customer Identification
VIP客户识别
Find the top 100 most valuable customers from our sales data for marketing campaign从我们的销售数据中找出前100位最有价值的客户,用于营销活动Customer Value Analysis
客户价值分析
Create a customer segmentation report showing revenue contribution by customer segment创建一份客户细分报告,展示各客户细分群体的收入贡献情况Key Features
核心功能
- Automatic Data Cleaning: Handles Chinese e-commerce data formats, removes invalid orders
- Intelligent Clustering: Uses elbow method to determine optimal cluster count
- Chinese Language Support: Full support for Chinese field names and visualizations
- Comprehensive Reports: Generates HTML reports, PNG dashboards, and CSV exports
- Marketing Ready: Provides VIP customer lists and actionable insights
- 自动数据清理:适配中文电商数据格式,移除无效订单
- 智能聚类:使用肘部法则确定最优聚类数量
- 中文支持:完全支持中文字段名与可视化内容
- 全面报告:生成HTML报告、PNG仪表盘与CSV导出文件
- 营销就绪:提供VIP客户列表与可落地的洞察建议
File Requirements
文件要求
The skill works with e-commerce transaction data containing:
- user_id: Customer identification code (用户码)
- order_date: Purchase date (消费日期)
- quantity: Order quantity (数量)
- unit_price: Item unit price (单价)
- product_info: Product details (optional)
本工具适用于包含以下字段的电商交易数据:
- user_id:客户标识码(用户码)
- order_date:购买日期(消费日期)
- quantity:订单数量(数量)
- unit_price:商品单价(单价)
- product_info:商品详情(可选)
Output Files Generated
生成的输出文件
- : Complete customer segmentation data
customer_segments.csv - : Ranked VIP customer list for marketing
vip_customers_list.csv - : Detailed statistics by segment
segment_summary_statistics.csv - : Visual analytics dashboard
customer_segmentation_dashboard.png - : Data quality and analysis validation
data_validation_report.txt
- :完整的客户细分数据
customer_segments.csv - :用于营销的已排序VIP客户列表
vip_customers_list.csv - :各细分群体的详细统计数据
segment_summary_statistics.csv - :可视化分析仪表盘
customer_segmentation_dashboard.png - :数据质量与分析验证报告
data_validation_report.txt
Dependencies
依赖项
- pandas, numpy for data processing
- scikit-learn for K-means clustering
- matplotlib, seaborn for visualization (with Chinese font support)
- Standard Python libraries for file operations
- pandas、numpy:用于数据处理
- scikit-learn:用于K-means聚类
- matplotlib、seaborn:用于可视化(支持中文字体)
- 标准Python库:用于文件操作
Best Practices
最佳实践
- Ensure date fields are in consistent format (YYYY-MM-DD recommended)
- Remove or handle missing values before analysis
- Use sufficient data volume (1000+ orders recommended for reliable clustering)
- Consider business context when interpreting segment results
- Validate results with domain knowledge when possible
- 确保日期字段格式一致(推荐使用YYYY-MM-DD格式)
- 分析前移除或处理缺失值
- 使用足够的数据量(推荐1000+订单以确保聚类结果可靠)
- 解读细分结果时结合业务场景
- 尽可能结合领域知识验证结果