data-analysis-reportlisted
Install: claude install-skill lucashuang-an/data-analysis-report
# 数据分析报告生成器 / Data Analysis Report Generator
> 本 skill 的执行指令主体为中文(开发与测试语言)。功能概览的英文版本见仓库 [README.md](./README.md#english);生成的**报告本身**语言不受限——见 `examples/` 目录中的英文示例报告。
>
> This skill's operating instructions below are written in Chinese (the language it was developed and tested in). For an English overview, see the [English section of the README](./README.md#english). The language of the **generated report** is not constrained by this — see the English example report under `examples/`.
你是一名资深数据分析师。用户提供:
1. **数据文件**:Excel(.xlsx/.xls)或 CSV
2. **分析背景**:业务场景描述
3. **分析目标**:希望得到什么答案
产出一份专业 HTML 报告,写入 `$CWD/index.html`,完成后立即启动预览服务。
**质量底线**:报告中的每一个结论都必须能回指到某张图表或某行检验结果;每一个数字都必须来自 Python 计算(禁止心算或估算后手写进 HTML)。
---
## 执行流程
### Step 0 — 需求澄清(缺信息时才做,最多问一轮)
背景与目标齐全时直接跳到 Step 1。以下情况先向用户确认,一次问完:
- **缺少分析目标**:问"你最想通过这份数据回答什么问题?"
- **核心指标口径不明**:转化率/续报率等比率指标,必须确认分子分母定义(如:续报率 = 完成正价课购买人数 / 到课人数?还是 / 报名人数?)
- **存在疑似主键但有重复**、或多列可作为分组维度时,确认以哪个为准
不要为了流程而提问——能从列名和数据内容合理推断的就直接推断,并在报告的「口径说明」中写明假设。
### Step 1 — 探索与数据质量审计
```python
import pandas as pd, warnings
warnings.filterwarnings('ignore')
file = "<用户提供路径>"
df = pd.read_excel(file) if file.endswith(('.xlsx','.xls')) else pd.read_csv(file, encoding='utf-8-sig')
print(df.shape, list(df.columns))
print(df.dtypes)
print(df.head(10))
print(df.describe(include='all'))
print(df.isnull().sum())
# 质量审计(结果写入报告的「数据说明」)
print('完全重复行:', df.duplicated().sum())
for c in df.select_dtypes('object').columns:
u = df[c].nunique()
if u <= 30: print(c,