chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: csv-workbench
|
||||
description: Analyze CSV files in /mnt/data and return concise numeric summaries.
|
||||
---
|
||||
|
||||
# CSV Workbench
|
||||
|
||||
Use this skill when the user asks for quick analysis of tabular data.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Inspect the CSV schema first (`head`, `python csv.DictReader`, or both).
|
||||
2. Compute requested aggregates with a short Python script.
|
||||
3. Return concise results with concrete numbers and units when available.
|
||||
|
||||
## Constraints
|
||||
|
||||
- Prefer Python stdlib for portability.
|
||||
- If data is missing or malformed, state assumptions clearly.
|
||||
- Keep the final answer short and actionable.
|
||||
@@ -0,0 +1,32 @@
|
||||
# CSV Playbook
|
||||
|
||||
## Quick checks
|
||||
|
||||
- Preview rows: `head -n 10 /mnt/data/your-file.csv`.
|
||||
- Count rows:
|
||||
|
||||
```bash
|
||||
python - <<'PY'
|
||||
import csv
|
||||
|
||||
with open('/mnt/data/your-file.csv', newline='') as f:
|
||||
print(sum(1 for _ in csv.DictReader(f)))
|
||||
PY
|
||||
```
|
||||
|
||||
## Grouped totals template
|
||||
|
||||
```bash
|
||||
python - <<'PY'
|
||||
import csv
|
||||
from collections import defaultdict
|
||||
|
||||
totals = defaultdict(float)
|
||||
with open('/mnt/data/your-file.csv', newline='') as f:
|
||||
for row in csv.DictReader(f):
|
||||
totals[row['region']] += float(row['amount'])
|
||||
|
||||
for region in sorted(totals):
|
||||
print(region, round(totals[region], 2))
|
||||
PY
|
||||
```
|
||||
Reference in New Issue
Block a user