Skip to main content

csvpeek

CI Release Python License: MIT Zero dependencies

A fast, zero-dependency CSV profiler for the terminal. Point it at a file and get column types, null counts, numeric statistics, and top values, in one glance.

Pure Python standard library. Deterministic: the same file always produces the same profile. No pandas, no install-time downloads, nothing leaves your machine.

$ csvpeek examples/people.csv

  6 rows × 5 columns

  column  type      nulls  unique  summary
  ────────────────────────────────────────
  name    string        0       6  Ann (1), Bob (1), Cara (1), Dan (1), Eve (1)
  age     int     1 (16.7%)       4  min 22 · p25 25.5 · median 29 · p75 37.5 · max 41 · mean 31 · sd 6.2929
  city    string        0       3  Santa Cruz (3), Brentwood (2), Oakland (1)
  active  bool          0       2  true (4), false (2)
  score   float   1 (16.7%)       5  min 6.5 · p25 6.8 · median 8.8 · p75 9.2 · max 9.4 · mean 8.16 · sd 1.143

Install

Requires Python 3.9+.

pip install csvpeek-cli

The distribution is csvpeek-cli because csvpeek on PyPI belongs to an unrelated project. The command, the import and this repository are all still csvpeek; only the string after pip install differs.

Or run it straight from a clone, no install needed:

python -m csvpeek data.csv

Usage

csvpeek data.csv                 # profile a CSV
csvpeek data.tsv -d $'\t'        # tab-separated
csvpeek data.csv --top 10        # more top values for text columns
csvpeek big.csv -n 10000         # sample the first 10k rows of a large file
csvpeek data.csv --format md     # a Markdown table to paste into a PR
csvpeek data.csv --json          # machine-readable output
csvpeek data.csv --no-color      # plain text
Flag Description
-d, --delimiter Field delimiter (default: auto-detect , ; tab |)
-t, --top N Show top N values for text columns (default 5)
-n, --limit ROWS Only read the first ROWS data rows (sample large files)
--format {table,md,json} Output format: table (default), md (Markdown), or json
--json Shortcut for --format json
--no-color Disable colored output
-V, --version Print version

What it computes

  • Type inference per column: int, float, bool, date, string, or empty. A column takes a type only if every non-null value fits; one stray label keeps it a string (no silent coercion). Dates require a separator (2024-01-01, 01/02/2024), so bare years and ids stay numeric.
  • Nulls: empty, NA, N/A, null, none, nan, nil (case-insensitive), with a percentage.
  • Numeric columns: min, 25th/50th/75th percentiles, max, mean, and population standard deviation.
  • Text/bool columns: unique count and the most common values (ties broken alphabetically, so runs are reproducible).

Library

Everything the CLI does is available as a small API:

from csvpeek import profile_file

profile = profile_file("data.csv")
print(profile.rows)
for col in profile.columns:
    print(col.name, col.dtype, col.nulls, col.mean)

profile.to_dict()   # JSON-ready

Documentation

Document What it covers
docs/cli.md Every flag, output format, and exit code
docs/profiling.md The exact rules behind every number csvpeek prints
docs/api.md Using csvpeek as a library

Development

pip install pytest .
pytest -q

License

MIT © Martin Muskov

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csvpeek_cli-1.0.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csvpeek_cli-1.0.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file csvpeek_cli-1.0.0.tar.gz.

File metadata

  • Download URL: csvpeek_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for csvpeek_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8df0ee8f516036d21466c145575d6c1f97a918e6ddd41c032e2d56555068859a
MD5 fc929ce03ec3d59a0c1a66df7bb234ff
BLAKE2b-256 d36fda7f71c078c54b4e89f10e6779eaed39104352a4bf5033bfac47491c2c08

See more details on using hashes here.

File details

Details for the file csvpeek_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: csvpeek_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for csvpeek_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a0321f2a19dbd2234500f1451567adab583a8568af8fe2fbe68e8423880fedd
MD5 bd33e88c2b360d241dcf359ba3f167cc
BLAKE2b-256 3da0ef6461e866ea183122c992954165a9758d7220b99f280e07f947f6ead792

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page