|
@@ -35,24 +35,25 @@ class ReportGenerator:
|
|
|
}
|
|
|
|
|
|
# 打印报告摘要
|
|
|
- print("Report Summary:")
|
|
|
- print(f"Total Users: {report['total_users']}")
|
|
|
- print(f"Total Actions: {report['total_actions']}")
|
|
|
- print(f"Anomalies: {report['anomalies']}")
|
|
|
- print(f"User Segments: {report['user_segments']}")
|
|
|
+ print("报告摘要:")
|
|
|
+ print(f"总客户数: {report['total_users']}")
|
|
|
+ print(f"总行为次数: {report['total_actions']}")
|
|
|
+ print(f"异常客户: {report['anomalies']}")
|
|
|
+ print(f"客户分群-高活跃用户: {report['user_segments']['高活跃用户']},")
|
|
|
+ print(f"客户分群-低活跃用户: {report['user_segments']['低活跃用户']},")
|
|
|
|
|
|
# 展示每个流程的行为次数漏斗图
|
|
|
for process, actions in self.process_stats.items():
|
|
|
- self.plot_bar(actions, f"{process} Funnel")
|
|
|
+ self.plot_bar(actions, f"{process} 漏斗图")
|
|
|
|
|
|
# 展示行为统计图表
|
|
|
- self.plot_stats(self.action_stats, "Action Statistics")
|
|
|
+ self.plot_stats(self.action_stats, "行为次数统计")
|
|
|
|
|
|
# 展示产品统计图表
|
|
|
- self.plot_stats(self.product_stats, "Product Statistics")
|
|
|
+ self.plot_stats(self.product_stats, "分产品统计")
|
|
|
|
|
|
# 展示渠道统计图表
|
|
|
- self.plot_stats(self.channel_stats, "Channel Statistics")
|
|
|
+ self.plot_stats(self.channel_stats, "分渠道统计")
|
|
|
|
|
|
return report
|
|
|
|
|
@@ -90,8 +91,8 @@ class ReportGenerator:
|
|
|
# 设置横坐标和纵坐标
|
|
|
ax.set_yticks(positions)
|
|
|
ax.set_yticklabels(labels)
|
|
|
- ax.set_xlabel('Number of Actions')
|
|
|
- ax.set_ylabel('Behavior')
|
|
|
+ ax.set_xlabel('行为次数')
|
|
|
+ ax.set_ylabel('')
|
|
|
|
|
|
ax.set_title(title)
|
|
|
|