data-analyze-refined

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Data Analyze Refined Skill

Data Analyze Refined Skill

适用场景:把任意 Excel/CSV 做成“市场部可用”的一键分析包——自动识别核心维度/指标,产出 CSV + 带目录回链的 Excel 汇总、PNG/SVG 图表、HTML 信息图、市场策略化的 Word 报告。默认输出在数据同级的
outputs/
。跨行业通用,优先从字段中判断品牌/产品/客户/渠道/区域/机构等维度再决定分析重点,不要求用户先定义完整分析题。
Use cases: Turn any Excel/CSV file into a “marketing-team-ready” one-click analysis package—automatically identify core dimensions and metrics, then produce a CSV + an Excel summary with table-of-contents backlinks, PNG/SVG charts, an HTML infographic, and a market-strategy-oriented Word report. Outputs are written by default to
outputs/
alongside the source data. It works across industries, first inferring dimensions such as brand/product/customer/channel/region/institution from the fields and then deciding the analytical focus, without requiring the user to define a complete analytical question in advance.

核心原则

Core Principles

  • 市场视角优先:用业务语言解释现状、机会、策略、风险,避免学术表达与模型化术语。
  • 自动判别方向:字段缺失时做可替代的洞察,不因“数据不全”而停工。
  • 图表服从洞察:图表数量与类型由洞察决定,不固定数量,不为画图而画图。
  • 先结论后展开:先给管理层可读结论,再展开证据与明细。
  • Market perspective first: Explain the current state, opportunities, strategy, and risks in business language, avoiding academic expressions and model-oriented terminology.
  • Automatically determine the analysis direction: When fields are missing, produce alternative insights rather than stopping because the data is incomplete.
  • Charts follow insights: The number and type of charts are determined by the insights. Do not create charts merely for the sake of visualization.
  • Conclusions first, details later: Begin with conclusions that management can easily understand, then present the supporting evidence and details.

快速使用

Quick Usage

bash
undefined
bash
undefined

默认输出到数据同级 outputs/

默认输出到数据同级 outputs/

node src/index.js /path/to/data.xlsx --sheet "导出数据表" --core-dimension "申报企业名称" --value-column "协议采购量" --charts-mode on
node src/index.js /path/to/data.xlsx --sheet "导出数据表" --core-dimension "申报企业名称" --value-column "协议采购量" --charts-mode on

自定义输出目录

自定义输出目录

node src/index.js /path/to/data.xlsx --sheet "工作表" --output-dir "/path/to/outputs"
node src/index.js /path/to/data.xlsx --sheet "工作表" --output-dir "/path/to/outputs"

图表策略:auto/on/off(默认 auto);截图需要时加 --enable-screenshot

图表策略:auto/on/off(默认 auto);截图需要时加 --enable-screenshot


环境依赖:
- Python 3.8+ 且 `pip install -r requirements.txt`(pandas/numpy/matplotlib/seaborn/openpyxl/python-docx 等)
- Node 18+ 可选,仅用于 node 入口;先 `npm install`(已移除错误依赖)。若 npm 报错可直接用 `python3 src/main.py ...`。

必选/优先参数:
- `--sheet`:Excel 工作表名(CSV 可省略)
- `--core-dimension`:核心实体列(优先品牌/企业;若不指定自动推断)
- `--value-column`:核心指标列(优先采购量/数量/总量类)
- `--target-brand`:可选,目标品牌/申报企业,用于白区/机会(缺省时可取头部品牌或公司名)

Environment requirements:
- Python 3.8+ and `pip install -r requirements.txt` (pandas/numpy/matplotlib/seaborn/openpyxl/python-docx, etc.)
- Node 18+ is optional and used only for the Node.js entry point; run `npm install` first (the incorrect dependency has been removed). If npm reports an error, you can directly use `python3 src/main.py ...`.

Required/preferred parameters:
- `--sheet`: Excel worksheet name (optional for CSV)
- `--core-dimension`: Core entity column (brand/company preferred; inferred automatically if unspecified)
- `--value-column`: Core metric column (purchase volume/quantity/total volume preferred)
- `--target-brand`: Optional target brand/applicant company used for white-space and opportunity analysis (if omitted, the leading brand or company name may be used)

自动分析路由(行业无关)

Automatic Analysis Routing (Industry-Agnostic)

字段条件优先洞察常用图表
有时间 + 数值趋势、增长来源、波动风险折线图、面积图
有地区/城市 + 数值区域机会、白区、区域集中度排名条形图、散点/气泡图
有渠道 + 数值渠道效率、渠道白区、预算分配分组条形图、漏斗图
有产品/SKU + 数值结构贡献、价格带、替代机会堆叠条形图、帕累托图
有客户/机构 + 数值重点客户贡献、覆盖深度、空白客户排名条形图、分布图
仅有分类 + 数值份额、集中度、TopN 贡献条形图、帕累托图
Field conditionPriority insightsCommon charts
Time + numeric valueTrends, growth sources, volatility riskLine chart, area chart
Region/city + numeric valueRegional opportunities, white spaces, regional concentrationRanked bar chart, scatter/bubble chart
Channel + numeric valueChannel efficiency, channel white spaces, budget allocationGrouped bar chart, funnel chart
Product/SKU + numeric valueStructural contribution, price bands, substitution opportunitiesStacked bar chart, Pareto chart
Customer/institution + numeric valueKey customer contribution, coverage depth, untapped customersRanked bar chart, distribution chart
Category only + numeric valueShare, concentration, TopN contributionBar chart, Pareto chart

工作流(自动判别 → 市场洞察)

Workflow (Automatic Direction Detection → Market Insights)

  1. 读取与预处理
    • 去除列名空白,统一别名:
      品牌/企业/厂家/供应商 -> 品牌名称
      ;
      地区/地市/区域 -> 城市
      (层级字段可按分隔符取市级);
      目录/品类/类目 -> 产品大类
      。
    • 关键数值列尝试转为数值:
      数量/销量/订单量/GMV/金额/合同量/需求量/消耗量
      。
  2. 自动判别核心维度/指标
    • 核心维度优先顺序:品牌/申报企业/厂家 → 医院/渠道/客户 → 城市/区域 → 其他非唯一度低的分类列。
    • 核心指标优先顺序:
      --value-column
      > 数量/销量/订单量/GMV/金额/合同量/需求量 > 首个数值列。
  3. 降噪规则
    • 分类 TopN 仅用于唯一值 2~50 且非 90% 全唯一的列;全一致/全唯一列跳过。
    • 相关性需 ≥0.3 且存在 ≥2 个数值列;否则不输出。
    • 无时间列/价格列时明确说明不做趋势/价量分析,用结构/覆盖/机会替代。
  4. 分析视角
    • 字段画像、数值统计、分类分布、集中度(Top1/3/5、覆盖 80/90 所需实体数、离群阈值)。
    • 份额与交叉:品牌/企业、城市、渠道、品类/SKU;品牌×城市、品牌×渠道、城市×品类、品牌内产品Top。
    • 覆盖与客户:覆盖客户数/单客均量(核心维度),客户TOP,目标品牌的客户白区(低份额×高容量)。
    • 机会:目标品牌白区(城市总量×目标品牌份额),并生成机会优先级(影响×可行性×投入效率);如有时间/价格/结构则补充价格带、结构占比、时间趋势。
  5. 输出生成
    • CSV:核心维度/城市/目录/大类/覆盖、城市品牌分布、城市Top3、城市白区、机会优先级(城市/医院或客户)、产品分布、品牌产品分布、城市产品分布、品牌产品Top、客户TOP、客户白区等(字段概览/数值统计仅供参考)。
    • Excel:
      outputs/excel/数据分析汇总.xlsx
      (目录页+返回目录,含上述业务表;默认不放字段概览/数值统计)。
    • 图表:按 charts-mode 生成 PNG+SVG 至
      outputs/figures/{png,svg}
      (核心维度份额、城市、目录、大类、覆盖等,自动判断是否有意义;图表数量由洞察点数决定)。
    • HTML:
      outputs/html/market_analysis_infographic.html
      (核心结论/机会摘要+嵌入核心图表),
      outputs/html/charts_gallery.html
      (图表汇总)。
    • Word 报告:
      outputs/reports/<数据名>_分析报告.docx
      ,站在市场部视角给核心结论、白区/机会、策略、行动计划(无字段时也要明确缺口)。
  1. Reading and preprocessing
    • Remove whitespace from column names and normalize aliases:
      品牌/企业/厂家/供应商 -> 品牌名称
      ;
      地区/地市/区域 -> 城市
      (for hierarchical fields, extract the city level according to the delimiter);
      目录/品类/类目 -> 产品大类
      .
    • Attempt to convert key numeric columns to numeric values:
      数量/销量/订单量/GMV/金额/合同量/需求量/消耗量
      .
  2. Automatically identify core dimensions and metrics
    • Core dimension priority: brand/applicant company/manufacturer → hospital/channel/customer → city/region → other categorical columns with low uniqueness.
    • Core metric priority:
      --value-column
      > quantity/sales/order volume/GMV/amount/contract volume/demand > the first numeric column.
  3. Noise-reduction rules
    • Use categorical TopN only when a column has 2–50 unique values and is not at least 90% unique; skip columns whose values are entirely identical or entirely unique.
    • Correlation requires a value of at least 0.3 and at least two numeric columns; otherwise, do not output it.
    • When there is no time or price column, explicitly state that trend or price-volume analysis is not being performed, and use structure, coverage, or opportunity analysis instead.
  4. Analytical perspectives
    • Field profiling, numerical statistics, categorical distribution, and concentration (Top 1/3/5, number of entities required for 80%/90% coverage, and outlier thresholds).
    • Share and cross-tab analysis: brand/company, city, channel, category/SKU; brand × city, brand × channel, city × category, and top products within each brand.
    • Coverage and customer analysis: number of covered customers/average volume per customer for the core dimension, top customers, and target-brand customer white spaces (low share × high capacity).
    • Opportunities: target-brand white spaces (city total × target-brand share), with opportunity priorities calculated from impact × feasibility × investment efficiency. If time, price, or structural fields are available, add insights on price bands, structural mix, and time trends.
  5. Output generation
    • CSV: core dimension/city/product category/major category/coverage, city-brand distribution, city Top 3, city white spaces, opportunity priorities (city/hospital or customer), product distribution, brand-product distribution, city-product distribution, top products within brands, customer TOP, customer white spaces, etc. (field overview/numerical statistics are for reference only).
    • Excel:
      outputs/excel/数据分析汇总.xlsx
      (table-of-contents sheet + links back to it, containing the business tables above; field overview/numerical statistics are excluded by default).
    • Charts: Generate PNG + SVG files in
      outputs/figures/{png,svg}
      based on charts-mode (core dimension share, city, product category, major category, coverage, etc.); automatically determine whether each chart is meaningful, and base the chart count on the number of insights.
    • HTML:
      outputs/html/market_analysis_infographic.html
      (core conclusions/opportunity summary + embedded core charts) and
      outputs/html/charts_gallery.html
      (chart gallery).
    • Word report:
      outputs/reports/<数据名>_分析报告.docx
      , written from the marketing team’s perspective with core conclusions, white spaces/opportunities, strategy, and an action plan; explicitly identify data gaps even when fields are missing.

最小可交付(数据稀疏时仍要产出)

Minimum Deliverables (Still Required for Sparse Data)

  • 至少输出:
    1页结论
    +
    >=1张有效图
    +
    >=1个机会清单CSV
    。
  • 若无时间列:移除趋势,强化结构/覆盖/机会。
  • 若无金额列:移除价格带,保留数量份额与集中度。
  • 若无地区列:移除区域白区,转为渠道/客户白区。
  • 若仅 1 个数值列:不做相关性,只做分布、份额、集中度和TopN。
  • Always output at least: a one-page conclusion section + at least one meaningful chart + at least one opportunity-list CSV.
  • If there is no time column: remove trend analysis and strengthen structural, coverage, and opportunity insights.
  • If there is no amount column: remove price bands and retain quantity share and concentration analysis.
  • If there is no region column: remove regional white-space analysis and switch to channel/customer white spaces.
  • If there is only one numeric column: do not perform correlation analysis; analyze distributions, shares, concentration, and TopN only.

结论页结构(必须包含)

Conclusion Page Structure (Required)

  • 现状解读:市场规模/结构/集中度/覆盖等关键事实。
  • 洞察体现:增长来源、结构错配、白区/机会清单、渠道/区域差异。
  • 未来策略:扩点/深耕/产品结构/价格带/预算调整等可执行路径。
  • 风险分析:数据缺口、结构不匹配风险、渠道依赖、集中度过高风险等。
  • Current-state interpretation: Key facts such as market size, structure, concentration, and coverage.
  • Insights: Growth sources, structural mismatches, white-space/opportunity lists, and channel/regional differences.
  • Future strategy: Actionable paths such as expanding coverage, deepening existing accounts, adjusting product mix or price bands, and reallocating budget.
  • Risk analysis: Data gaps, structural mismatch risks, channel dependency, excessive concentration, and other relevant risks.

图表选择规则(按洞察驱动)

Chart Selection Rules (Insight-Driven)

  • 份额/集中度:条形图、堆叠条形或帕累托。
  • 结构/价格带:100% 堆叠条形或分组条形。
  • 机会/白区:散点或气泡图(量×份额/覆盖)。
  • 趋势(仅有时间列):折线或面积图。
  • 渠道效率/漏斗:漏斗图或转化率条形。
  • Share/concentration: Bar chart, stacked bar chart, or Pareto chart.
  • Structure/price bands: 100% stacked bar chart or grouped bar chart.
  • Opportunities/white spaces: Scatter or bubble chart (volume × share/coverage).
  • Trends (only when a time column exists): Line or area chart.
  • Channel efficiency/funnel: Funnel chart or conversion-rate bar chart.

机会优先级规则(新增)

Opportunity Priority Rules (New)

  • 影响分:潜在增量规模(总量 × 份额缺口)。
  • 可行性分:已有基础(目标品牌量/既有覆盖)或份额缺口替代。
  • 投入效率分:投入强度近似(规模越大通常投入越高,分值越低)。
  • 综合优先级分:按“影响 × 可行性 × 投入效率”融合排序,输出高优先/中高优先/中优先/观察。
  • Impact score: Potential incremental scale (total volume × share gap).
  • Feasibility score: Existing foundation (target-brand volume or existing coverage), with share gap used as a proxy when necessary.
  • Investment efficiency score: Approximates investment intensity; larger scale generally requires more investment and therefore receives a lower score.
  • Overall priority score: Rank by combining “impact × feasibility × investment efficiency” and output high priority, medium-high priority, medium priority, or watchlist.

市场部报告要点

Marketing Team Report Highlights

  • 核心结论:总量、CR3/CR5、龙头品牌与份额、主力目录/城市、覆盖(覆盖医院数/城市数/单院均量)。
  • 产品/结构:品类/SKU Top、品牌内主打产品/结构(有产品或结构列时)。
  • 机会:目标品牌城市白区、客户白区(低份额×高容量),如有价格/时间/结构字段则补充对应洞察。
  • 行动计划:头部清单、长尾/白区试点、产品/结构/价格打法、补充字段建议(时间/渠道/价格等)。
  • Core conclusions: Total volume, CR3/CR5, leading brands and shares, primary product categories/cities, and coverage (number of hospitals/cities covered and average volume per hospital).
  • Products/structure: Top categories/SKUs and flagship products or mix within each brand when product or structural fields are available.
  • Opportunities: Target-brand city white spaces and customer white spaces (low share × high capacity), supplemented with price, time, or structural insights when those fields exist.
  • Action plan: Priority target list, long-tail/white-space pilots, product/mix/pricing tactics, and recommendations for additional fields such as time, channel, and price.

快速参考

Quick Reference

场景关键维度默认洞察
销售/订单城市/渠道/产品城市机会、渠道白区、结构/价格带、增长来源
投放/线索渠道/地区ROI、漏斗转化、渠道效率、预算优化
招投标/中标地区/机构/品牌竞争格局、集中度、白区机构、策略路径
ScenarioKey dimensionsDefault insights
Sales/ordersCity/channel/productCity opportunities, channel white spaces, mix/price bands, growth sources
Campaigns/leadsChannel/regionROI, funnel conversion, channel efficiency, budget optimization
Tenders/bid winsRegion/institution/brandCompetitive landscape, concentration, white-space institutions, strategic paths

常见错误与修正

Common Mistakes and Corrections

  • 过学术:出现显著性检验/回归模型 → 改为业务指标与对比口径。
  • 图表硬凑:没有洞察也画图 → 只保留能支撑结论的图表。
  • 数据缺失即停:缺时间/价格就不输出 → 改为结构/覆盖/机会洞察并说明缺口。
  • 结论过简:只给一句话 → 按“现状-洞察-策略-风险”补全。
  • Too academic: significance tests or regression models are used → replace them with business metrics and comparison criteria.
  • Forced charts: charts are created without supporting insights → retain only charts that support the conclusions.
  • Stopping when data is missing: omit output because time or price fields are unavailable → produce structural, coverage, and opportunity insights and disclose the gaps.
  • Conclusion too brief: provide only one sentence → complete it using the “current state–insights–strategy–risk” structure.

理性化与纠偏

Rationalizations and Corrections

借口纠偏
“数据不全,先不输出”先给可替代洞察,并明确缺口与补充建议。
“需要统计检验才可靠”用业务口径对比与结构差异给结论。
“固定输出3张图更稳妥”图表数量由洞察决定,宁少勿乱。
“结论页一句话即可”必须包含现状、洞察、策略、风险四段。
ExcuseCorrection
“The data is incomplete, so I will not output anything”First provide alternative insights, then clearly identify the gaps and recommend additional fields.
“Statistical tests are required for reliability”Draw conclusions using business-basis comparisons and structural differences.
“Generating exactly three charts is safer”The number of charts is determined by the insights; fewer is better than clutter.
“A one-sentence conclusion page is enough”It must contain four sections: current state, insights, strategy, and risk.

红旗清单(出现即纠正)

Red Flag Checklist (Correct Immediately When Present)

  • 使用学术/模型术语替代业务语言
  • 固定图表数量或模板化结论
  • 因字段缺失直接停止输出
  • 结论缺少策略或风险
  • Using academic or model-oriented terminology instead of business language
  • Fixing the chart count or using templated conclusions
  • Stopping output because fields are missing
  • Providing conclusions without strategy or risk

示例(Python)

Example (Python)

python
undefined
python
undefined

根据字段可用性选择洞察与图表(示意)

根据字段可用性选择洞察与图表(示意)

fields = {"日期", "城市", "渠道", "产品", "数量", "金额"} insights = [] charts = []
if "城市" in fields and "数量" in fields: insights.append("城市机会与白区") charts.append("城市份额条形图/白区散点") if "渠道" in fields and "金额" in fields: insights.append("渠道效率与预算建议") charts.append("渠道ROI条形图") if "日期" in fields: insights.append("增长来源与趋势") charts.append("时间趋势折线")
report_sections = ["现状解读", "洞察体现", "未来策略", "风险分析"]
undefined
fields = {"日期", "城市", "渠道", "产品", "数量", "金额"} insights = [] charts = []
if "城市" in fields and "数量" in fields: insights.append("城市机会与白区") charts.append("城市份额条形图/白区散点") if "渠道" in fields and "金额" in fields: insights.append("渠道效率与预算建议") charts.append("渠道ROI条形图") if "日期" in fields: insights.append("增长来源与趋势") charts.append("时间趋势折线")
report_sections = ["现状解读", "洞察体现", "未来策略", "风险分析"]
undefined

资源

Resources

  • 代码:
    src/main.py
    (管线)、
    src/data_analyzer.py
    (预处理/分析)、
    src/chart_generator.py
    (图表)、
    src/infographic_generator.py
    、
    src/screenshot_generator.py
    。
  • 参考:
    references/playbook.md
    (SOP/字段映射/降噪要点)。
  • 示例结构:
    examples/
    (示例输入与报告形态参考)。
  • Code:
    src/main.py
    (pipeline),
    src/data_analyzer.py
    (preprocessing/analysis),
    src/chart_generator.py
    (charts),
    src/infographic_generator.py
    , and
    src/screenshot_generator.py
    .
  • Reference:
    references/playbook.md
    (SOP, field mapping, and noise-reduction key points).
  • Example structure:
    examples/
    (sample inputs and report-format references).