Natural-Language Data Analysis
Overview
Turn natural-language questions about tabular data into executable analysis: profile the dataset, translate the question into pandas (or SQL), produce charts, and summarize insights in plain language.
When to Use
- "分析这个表", "画个图", "这数据说明什么", "analyze", "make a chart", "数据可视化", "跑个分析", "correlation", "trend".
- The user uploads or points to a CSV, Excel, or database table.
- The user wants a quick exploratory view of a dataset.
Workflow
- Profile — Load the data; report shape, columns, types, missing counts, head. Use
scripts/profile_data.py(stdlib, no deps). - Clarify — If ambiguous (which column? what metric? time range?), ask one focused question. Do not guess silently.
- Translate — Map the question to pandas/SQL (groupby, agg, join, pivot). Prefer pandas for files, SQL for databases.
- Visualize — Generate a chart with
scripts/make_chart.py(requiresmatplotlib). Choose by intent: trend→line, distribution→hist/box, composition→bar/pie, relationship→scatter. - Summarize — State the finding in 1-3 sentences; include the number that matters.
Rules
- Never fabricate statistics. Compute from the actual data.
- One chart per question unless comparing.
- Keep code minimal; load the data once, reuse the DataFrame.
- Save outputs to the working directory; report the path.
Bundled Resources
scripts/profile_data.py— profile a CSV (shape, columns, missing, head) with no third-party dependencies.scripts/make_chart.py— generate a chart from a CSV + column spec (install:pip install matplotlib).references/analysis-patterns.md— common NL→pandas translations and chart-selection guidance.