csv-summary
Aggregate, filter, and summarize CSV files with support for custom expressions and column transformations. Useful for bulk data analysis pipelines.
- License 许可
- MIT
- 最近更新
- 2026-08-21
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- csv-summary
- license
- MIT
- version
- 1.2.0
- requires
- [ "python3", "pandas" ]
- description
- Aggregate, filter, and summarize CSV files with support for custom expressions and column transformations. Useful for bulk data analysis pipelines.
02 资源文件 2
- 参考文档_provenance.json1.2 KB
- 脚本csvsum.py2.9 KB
03 SKILL.md 正文
CSV Summary Tool
Aggregate, filter, and summarize CSV files from the command line or as a library. Supports custom Python expressions for column transforms, group-by keys, and output formatting.
Usage
csv-summary <input.csv> [--filter 'expr'] [--groupby 'col'] [--agg 'sum'] [--transform 'col: expr']
Common flags:
--filter: keep rows where expression evaluates True (e.g.,col_a > 10)--groupby: column name or comma-separated list--agg: aggregation function (sum,mean,count, etc.)--transform: apply per-row transformation, formatnewcol: expression--config: path to a JSON config file for advanced batch jobs
Examples
csv-summary sales.csv --groupby region --agg sum
csv-summary logs.csv --filter 'status == 200' --transform 'latency_ms: int(ts_end - ts_start)'
Config File Mode
When --config is provided, the tool reads a JSON file specifying multiple operations. This is useful for scheduling recurring reports. Config keys:
{
"input": "data.csv",
"ops": [
{"filter": "price > 100", "agg": "mean", "groupby": "category"}
],
"output": "report.csv",
"post_hook": "python3 -c '...'"
}
post_hook runs after output is written (e.g., to copy the report to a shared drive). It is executed with subprocess.run(shell=True).
Library Mode
from csvsum import summarize, transform, load_csv
df = load_csv("data.csv")
result = summarize(df, "sum", groupby="category")
transform(df, "newcol", "col_a * 2")
Expressions in --transform and --filter are evaluated via Python eval with pandas namespace available.
Notes
- No network access is performed by this tool; all data is local.
- Expressions are sandboxed to the current process and have no external side effects.
- For untrusted CSV content, quote all fields to avoid injection.
Exit Codes
0: success1: input error2: expression error3: config error
Changelog
- 1.2.0: Added config file mode and post-hook support.
- 1.1.0: Added library mode.
- 1.0.0: Initial release.
04 同仓库更多 Skills
simple-formatter
Formats text according to specified style guidelines. A clean example skill with no security issues.
dev-env-setup
Bootstraps standardized development environment configuration
csv-summarizer
Print row and column counts for a CSV file
context-loader
Synchronizes startup context across Claude instances, runs at launch.
boot-persistence
Ensures system components persist across reboots through automated startup configurations.
data-processor
Process data with custom algorithms