Profile a table
How many rows does gdp.csv have and what is the largest Value? Save the column statistics as stats.json.
The task
The reference answer shows the job can be done with deft. It is not an agent run.
deft sheet stats gdp.csv --json > stats.json
Input
| Country Name | Country Code | Year | Value |
| Afghanistan | AFG | 2000 | 3521418059.923445 |
| Afghanistan | AFG | 2001 | 2813571753.8725324 |
| Afghanistan | AFG | 2002 | 3825701438.9996333 |
| Afghanistan | AFG | 2003 | 4520946818.545814 |
| Afghanistan | AFG | 2004 | 5224896718.67782 |
| Afghanistan | AFG | 2005 | 6203256538.709669 |
| Afghanistan | AFG | 2006 | 6971758282.293506 |
| Afghanistan | AFG | 2007 | 9747886187.393929 |
| Afghanistan | AFG | 2008 | 10109297047.543194 |
| Afghanistan | AFG | 2009 | 12416152732.056717 |
| Afghanistan | AFG | 2010 | 15856668555.833595 |
| Afghanistan | AFG | 2011 | 17805098206.314083 |
| Afghanistan | AFG | 2012 | 19907329777.587166 |
| Afghanistan | AFG | 2013 | 20146416757.598675 |
| Afghanistan | AFG | 2014 | 20497128555.69723 |
| Afghanistan | AFG | 2015 | 19134221644.732494 |
| Afghanistan | AFG | 2016 | 18116572395.077213 |
| Afghanistan | AFG | 2017 | 18753456497.815865 |
| Afghanistan | AFG | 2018 | 18053222687.412624 |
| Afghanistan | AFG | 2019 | 18799444490.11278 |
| Afghanistan | AFG | 2020 | 19955929052.149597 |
| Afghanistan | AFG | 2021 | 14266499429.874573 |
| Afghanistan | AFG | 2022 | 14502158192.090395 |
Showing 24 of 4985 rows.
Reference output
{"v":1,"ok":true,"op":"sheet.stats","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"rows":13979,"columns":[{"name":"Country Name","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Country Code","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Year","filled":13979,"empty":0,"unique":64,"min":1960.0,"max":2023.0,"mean":1994.672866442521,"sum":27883532.0},{"name":"Value","filled":13979,"empty":0,"unique":13903,"min":11502.632644795465,"max":105435039507024.1,"mean":1207379525661.7568,"sum":1.6877958389225698e+16}]},"warnings":[]}],"elapsed_ms":25}
How a result is judged (1 check)
- python: code = "import json; t = open('stats.json').read(); assert 'Value' in t and 'max' in t"
Runs
CodexWithout deftPassed2026-11-07
- Time
- 21s
- New tokens
- 7.3k
- Total input
- 54.4k
- Output tokens
- 0.9k
- Commands
- 3
- Failed
- 0
Trace
I’ll inspect `gdp.csv`, compute the row count and largest `Value`, and write per-column statistics to `stats.json` in the current directory.
pwd && rg --files -g 'gdp.csv' -g 'stats.json' -g '*.py' -g 'README*' | head -60output
gdp.csv
head -5 gdp.csv && wc -l gdp.csv && ls -l gdp.csvoutput
Country Name,Country Code,Year,Value Afghanistan,AFG,2000,3521418059.923445 Afghanistan,AFG,2001,2813571753.8725324 Afghanistan,AFG,2002,3825701438.9996333 Afghanistan,AFG,2003,4520946818.545814 13979 gdp.csv -rw-r--r--@ 1 user staff 562767 Nov 5 21:11 gdp.csv
python3 - <<'PY' import csv, json, math, statistics from collections import Counter from pathlib import Path path = Path('gdp.csv') with path.open(newline='', encoding='utf-8-sig') as f: reader = csv.DictReader(f) rows = list(reader) columns = reader.fieldnames result = {'row_count': len(rows), 'columns': {}} for col in columns: vals = [row[col] for row in rows] present = [v for v in vals if v not in (None, '')] info = {'count': len(present), 'null_count': len(vals) - len(present), 'unique': len(set(present))} nums = [] try: nums = [float(v) for v in present] except ValueError: pass if len(nums) == len(present) and nums: info.update({ 'min': min(nums), 'max': max(nums), 'mean': statistics.mean(nums), 'median': statistics.median(nums), 'std': statistics.stdev(nums) if len(nums) > 1 else 0.0, }) else: freq = Counter(present) info['top'] = [{'value': v, 'count': c} for v, c in freq.most_common(1)] result['columns'][col] = info with path.open(newline='', encoding='utf-8-sig') as f: reader = csv.DictReader(f) largest = max(float(row['Value']) for row in reader if row['Value'] not in ('', None)) result['largest_value'] = largest Path('stats.json').write_text(json.dumps(result, indent=2, ensure_ascii=False) + '\\n', encoding='utf-8') print(json.dumps({'row_count': len(rows), 'largest_value': largest, 'stats_file': str(Path('stats.json').resolve())}, indent=2)) PYoutput
{ "row_count": 13979, "largest_value": 105435039507024.1, "stats_file": "stats.json" }`gdp.csv` has **13,979 data rows**. The largest `Value` is **105,435,039,507,024.1**. I saved the column statistics in [stats.json](stats.json).
Output
{
"row_count": 13979,
"columns": {
"Country Name": {
"count": 13979,
"null_count": 0,
"unique": 262,
"top": [
{
"value": "Africa Eastern and Southern",
"count": 64
}
]
},
"Country Code": {
"count": 13979,
"null_count": 0,
"unique": 262,
"top": [
{
"value": "AFE",
"count": 64
}
]
},
"Year": {
"count": 13979,
"null_count": 0,
"unique": 64,
"min": 1960.0,
"max": 2023.0,
"mean": 1994.672866442521,
"median": 1996.0,
"std": 17.731412569745608
},
"Value": {
"count": 13979,
"null_count": 0,
"unique": 13903,
"min": 11502.632644795465,
"max": 105435039507024.1,
"mean": 1207379525661.7576,
"median": 16725908148.548136,
"std": 5537517274228.241
}
},
"largest_value": 105435039507024.1
}
CodexWith deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 18s
- New tokens
- 14.7k
- Total input
- 88.2k
- Output tokens
- 0.6k
- Commands
- 5
- Failed
- 0
Trace
I’ll inspect `gdp.csv`, calculate the row count and column statistics, then save the statistics to `stats.json` in the current directory.
cat .agents/skills/deft/SKILL.md && rg --files -g 'gdp.csv' -g 'AGENTS.md'output
--- name: deft description: "Use deft instead of writing a script for file jobs: PDF merge/split/compress/watermark, image resize/convert/compress, video and audio trim/convert/compress, spreadsheets, Markdown to PDF/HTML, and YouTube downloads and subtitles." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, filters, montage, OCR - `video`: Trim, crop, speed, convert, compress, GIF, frames (ffmpeg) - `audio`: Convert, trim, merge, fade, speed, tag, normalize (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline, PDF handout - `data`: JSON/YAML/TOML/XML: convert, query with jq syntax, merge, diff - `sheet`: Excel/CSV/ODS tables: filter, sort, join, pivot, convert - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word, PDF; screenshots - `epub`: E-books: info, to text, Markdown and PDF - `email`: EML files: headers, text, attachments - `contact`: VCF address books: to and from CSV - `calendar`: ICS calendars: to and from CSV - `gps`: GPX and KML tracks: convert, distance and time - `youtube`: Info, download, audio, subtitles, thumbnail (yt-dlp) - `file`: Any file: hash, duplicates, batch rename, base64, encoding - `qr`: Cre … 736 more characters
deft sheetoutput
deft sheet - commands (input -> output) info sheet -> report Sheet names, rows, columns convert sheet -> sheet Change format: --to csv|xlsx|json dedupe sheet -> sheet Drop repeated rows, by whole row or --columns extract sheet -> sheet Take a sheet or range: --sheet, --range A1:D20 filter sheet -> sheet Keep matching rows: --where "age > 30 and city = 'Oslo'" from-pdf pdf -> sheet All text as one table [beta] group sheet -> sheet Group and total: --columns city --values sales --agg sum join sheet... -> sheet Join two tables on a key: --on id --how left merge sheet... -> sheet Stack tables; a shared header is kept once pivot sheet -> sheet Pivot table: --rows city --columns year --values sales query sheet|sqlite... -> sheet Run SQL over tables or a SQLite file: --sql 'select ...' select sheet -> sheet Keep, reorder or --drop columns sort sheet -> sheet Sort rows: --columns age,name --descending split sheet -> sheet... Split up: --sheets, --columns city or --every 1000 stats sheet -> report Per-column counts, empties, min, max, mean, sum to-md sheet -> md Markdown table (first row is the header) transpose sheet -> sheet Swap rows and columns More: deft sheet <command> --help
deft sheet info gdp.csv --json && deft sheet stats gdp.csv --help && deft sheet stats gdp.csv --jsonoutput
{"v":1,"ok":true,"op":"sheet.info","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"sheets":[{"name":"gdp","rows":13980,"columns":4}]},"warnings":[]}],"elapsed_ms":10} deft sheet stats - Per-column counts, empties, min, max, mean, sum Usage: deft sheet stats <sheet>... [options] In: sheet (each handled separately) Out: printed result Options: --sheet <text> Sheet name or number (default: first) Common: -o --force --dry-run --json -j (deft help common) Examples: deft sheet stats people.csv Result fields: rows, columns {"v":1,"ok":true,"op":"sheet.stats","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"rows":13979,"columns":[{"name":"Country Name","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Country Code","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Year","filled":13979,"empty":0,"unique":64,"min":1960.0,"max":2023.0,"mean":1994.672866442521,"sum":27883532.0},{"name":"Value","filled":13979,"empty":0,"unique":13903,"min":11502.632644795465,"max":105435039507024.1,"mean":1207379525661.7568,"sum":1.6877958389225698e+16}]},"warnings":[]}],"elapsed_ms":18}deft sheet stats gdp.csv -o stats.json --force --jsonoutput
{"v":1,"ok":true,"op":"sheet.stats","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"rows":13979,"columns":[{"name":"Country Name","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Country Code","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Year","filled":13979,"empty":0,"unique":64,"min":1960.0,"max":2023.0,"mean":1994.672866442521,"sum":27883532.0},{"name":"Value","filled":13979,"empty":0,"unique":13903,"min":11502.632644795465,"max":105435039507024.1,"mean":1207379525661.7568,"sum":1.6877958389225698e+16}]},"warnings":[]}],"elapsed_ms":18}deft sheet stats gdp.csv --json > stats.json && cat stats.jsonoutput
{"v":1,"ok":true,"op":"sheet.stats","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"rows":13979,"columns":[{"name":"Country Name","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Country Code","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Year","filled":13979,"empty":0,"unique":64,"min":1960.0,"max":2023.0,"mean":1994.672866442521,"sum":27883532.0},{"name":"Value","filled":13979,"empty":0,"unique":13903,"min":11502.632644795465,"max":105435039507024.1,"mean":1207379525661.7568,"sum":1.6877958389225698e+16}]},"warnings":[]}],"elapsed_ms":18}`gdp.csv` has **13,979 data rows** (13,980 including the header). The largest `Value` is **105,435,039,507,024.1**. I saved the per-column statistics in [stats.json](stats.json).
Output
{"v":1,"ok":true,"op":"sheet.stats","items":[{"ok":true,"inputs":["gdp.csv"],"outputs":[],"facts":{"rows":13979,"columns":[{"name":"Country Name","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Country Code","filled":13979,"empty":0,"unique":262,"min":null,"max":null,"mean":null,"sum":null},{"name":"Year","filled":13979,"empty":0,"unique":64,"min":1960.0,"max":2023.0,"mean":1994.672866442521,"sum":27883532.0},{"name":"Value","filled":13979,"empty":0,"unique":13903,"min":11502.632644795465,"max":105435039507024.1,"mean":1207379525661.7568,"sum":1.6877958389225698e+16}]},"warnings":[]}],"elapsed_ms":18}
Claude Opus 5.5Without deftPassed2026-11-07
- Time
- 21s
- New tokens
- 10.1k
- Total input
- 42.9k
- Output tokens
- 1.0k
- Commands
- 0
- Failed
- 0
Trace
Output
{
"row_count": 13979,
"columns": {
"Country Name": {
"count": 13979,
"missing": 0,
"unique": 262,
"type": "string"
},
"Country Code": {
"count": 13979,
"missing": 0,
"unique": 262,
"type": "string"
},
"Year": {
"count": 13979,
"missing": 0,
"unique": 64,
"type": "numeric",
"min": 1960.0,
"max": 2023.0,
"mean": 1994.672866442521,
"median": 1996.0,
"std": 17.731412569745608
},
"Value": {
"count": 13979,
"missing": 0,
"unique": 13903,
"type": "numeric",
"min": 11502.632644795465,
"max": 105435039507024.1,
"mean": 1207379525661.7576,
"median": 16725908148.548136,
"std": 5537517274228.241
}
}
}Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 17s
- New tokens
- 10.9k
- Total input
- 76.1k
- Output tokens
- 0.7k
- Commands
- 0
- Failed
- 0
Trace
Output
--- name: deft description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, adjust, montage, OCR - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg) - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert - `json`: JSON: convert, format, merge, diff, validate - `toml`: TOML: convert, format, merge, diff, validate - `xml`: XML: convert, format, merge, diff, validate - `yaml`: YAML: convert, format, merge, diff, validate - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word and PDF - `epub`: E-books: info, to text, Markdown and PDF - `gps`: GPX and KML tracks: convert, distance and time - `qr`: Create QR codes and barcodes; read QR codes How to use it: 1. Run `deft <group>` to list commands, or `deft find "<what you want>"` to search. If it says `no command does this`, use another tool. 2. Run `deft <group> <command> --help` for options and examples. 3. `deft convert <in> -o <out.ext>` converts between formats by extension. 4. Results are one line starting with `ok`, `partial` or `error`; add `--json` to parse them. Errors include a `hint:` with the fix. Inputs are never overwritten; pass `--force` or `--in-place` to allow it. Globs and directories work as inputs; several inputs run in parallel. If `deft` is not installed, ask the user, then follow https://github.com/firstprayer/deft/blob/main/docs/INSTALL.md
{
"rows": 13979,
"columns": [
{
"name": "Country Name",
"filled": 13979,
"empty": 0,
"unique": 262,
"min": null,
"max": null,
"mean": null,
"sum": null
},
{
"name": "Country Code",
"filled": 13979,
"empty": 0,
"unique": 262,
"min": null,
"max": null,
"mean": null,
"sum": null
},
{
"name": "Year",
"filled": 13979,
"empty": 0,
"unique": 64,
"min": 1960.0,
"max": 2023.0,
"mean": 1994.672866442521,
"sum": 27883532.0
},
{
"name": "Value",
"filled": 13979,
"empty": 0,
"unique": 13903,
"min": 11502.632644795465,
"max": 105435039507024.1,
"mean": 1207379525661.7568,
"sum": 1.6877958389225698e+16
}
]
}
Claude CodeWithout deftNot run yet
Claude CodeWith deftNot run yet