csv-data-summarizer
Analyzes CSV files, generates summary stats, and plots quick visualizations using Python and pandas.
1How It Works & Mechanism
The entire capability is implemented in a single 182-line pandas function `summarize_csv(file_path)`: read CSV → route through fixed branches by column type → assemble a string report, while saving plots via `plt.savefig` directly into the **current working directory** during execution.
def summarize_csv(file_path): """ Comprehensively analyzes a CSV file and generates multiple visualizations. Args: file_path (str): Path to the CSV file Returns: str: Formatted comprehensive analysis of the dataset """ df = pd.read_csv(file_path)
Branching logic is strictly driven by column types or column name substrings rather than business or data semantics: numeric columns trigger statistics and correlations, object columns trigger value frequencies, and columns with 'date' or 'time' in their names trigger time-series analysis.
date_cols = [c for c in df.columns if 'date' in c.lower() or 'time' in c.lower()]
The report content and sequence are fixed: dataset overview (shape/column names) → per-column dtype → missing value statistics → numerical describe → correlation matrix → categorical Top 10 values → time-series range → generated chart list.
summary.append("📊 DATA OVERVIEW")
Visualizations consist of four conditional charts: correlation heatmap (≥2 numeric columns), time-series line chart (date column present and numeric columns present, up to 3 series), numeric distribution histograms (2x2 grid, up to 4 columns), and categorical horizontal bar charts (2x2 grid, up to 4 columns).
plt.savefig('correlation_heatmap.png', dpi=150) plt.close() charts_created.append('correlation_heatmap.png')
'Do not ask the user' is mandated as a top-priority strict behavioral rule: SKILL.md uses all-caps paragraphs forbidding all questions and options, demanding immediate execution of the full analysis and delivery in a single turn.
**DO NOT ASK THE USER WHAT THEY WANT TO DO WITH THE DATA.** **DO NOT OFFER OPTIONS OR CHOICES.**
Trigger contexts are explicitly specified (uploading/referencing a CSV, asking to summarize/analyze/visualize, wanting to inspect data structure and quality), along with rules for detecting missing values and date columns.
Claude should use this Skill whenever the user: - Uploads or references a CSV file - Asks to summarize, analyze, or visualize tabular data
Distribution is handled via a zip archive uploaded to Claude.ai Skills, while identical source code is maintained in the repository; files inside the zip match the repository workspace byte-for-byte (verified).
2. Go to [Claude.ai](https://claude.ai) → Settings → Capabilities → Skills 3. Upload the zip file 4. Enable the skill
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| package | pandas |
| package | matplotlib |
| package | seaborn |
| network | 无:脚本不发起任何网络请求(无 URL 取数、无遥测、无外部 API);仓库内 URL 仅出现在 README/resources 的徽章与社区链接中 |
4Recommended Governance & Evidence
- scripts/: Executes local script or command: python analyze.py [csv_path] (defaults to resources/sample.csv)
- scripts/ 或 SKILL.md: Declares dynamic installation of external language package dependencies
- 本地工作目录: File I/O and artifact output: writes PNG files with fixed filenames to the **current working directory**: correlation_heatmap.png, time_series_analysis.png, dis
5Second-Pass Verification
- [ok] 『无网络外发/无凭证读取』结论 — analyze.py imports 仅 pandas/matplotlib.pyplot/seaborn/pathlib;全仓(排除 .git)关键词扫描 requests|urllib|socket|http|subprocess|os.system|getenv|os.environ 零命中;URL 仅出现在 README/resources/README 的徽章与社区链接。
- [discrepancy] 日期列判据与文档不符(实测) — SKILL.md Notes 写 'Automatically detects date columns (columns containing \'date\' in name)',实际代码是 "'date' in c.lower() or 'time' in c.lower()"。实测在仓库自带演示集上命中 **customer_lifetime_value**('life**time**' 含 'time'),随后 pd.to_datetime 把 2400 一类整数按纳秒解释成 1970 年,输出 'Date range: 1970-01-01 … to 1970-01-01 …'、'Span: 0 days',并据此画出无意义的时间序列图(实测 pandas 3.0.5;该行为与 pandas 2.x 一致:to_datetime(int) 亦按纳秒)。即 README 宣称该演示集『Perfect for showcasing time-series analysis』,实际触发的是误判列。
- [discrepancy] 『自适应/智能识别行业数据类型』的能力声明 — SKILL.md 列出 Sales/E-commerce、Customer、Financial、Operational、Survey 五类数据的『相应分析』,README 写 'Automatically detects data type (sales, customer, financial, survey, etc.) and applies relevant analysis';但 analyze.py 没有任何行业或语义分类代码,全部行为由 dtype 与列名子串决定(number→describe/corr/hist,object→value_counts/barh,含 date|time→区间)。属**能力夸大**:它确实会因列构成不同而产出不同报告,但没有『识别数据类型』这一步。
- [discrepancy] Notes『Generates visualizations only when date columns are present』 — 实际仅 time_series_analysis.png 需要日期列;distributions.png 只需数值列、categorical_distributions.png 只需分类列、correlation_heatmap.png 只需 ≥2 数值列。该句把条件说得比实现更严,属文档描述偏差(本身不影响使用)。
- [discrepancy] SKILL.md『Files』清单与仓库实际文件 — SKILL.md 只列 analyze.py、requirements.txt、resources/sample.csv、resources/README.md;仓库另有 examples/showcase_financial_pl_data.csv(README 重点宣传的演示集)与 csv-data-summarizer.zip(分发包)。清单不完整。
- [ok] 分发包与源码一致性 — zip 内 analyze.py(sha256 fa217db952541d59…)、SKILL.md(1599338ac2db52ba…)、requirements.txt(3787888dbf39eb94…)与工作区同名文件哈希完全相同;zip 结构为 SKILL.md/analyze.py/requirements.txt/resources/{sample.csv,README.md}。
- [ok] 依赖声明三重一致 — SKILL.md frontmatter metadata(python>=3.8, pandas>=2.0.0, matplotlib>=3.7.0, seaborn>=0.12.0)与 requirements.txt 三行、README Technical Details 段逐项吻合;实际运行时三项库均被 import(seaborn 用于 heatmap,matplotlib 用于绘图)。
- [ok] 写盘行为与覆盖风险 — 四处 plt.savefig 全部使用相对文件名(correlation_heatmap.png / time_series_analysis.png / distributions.png / categorical_distributions.png)+ dpi=150 + plt.close();不创建目录、不检查同名文件、不接受输出路径参数——已在 file_writes 与 risks 记入。
6Verdict & Scenarios
812ec659a4b533a8…