tiny rust cli that peeks at a csv file and tells you what's in it. column types, null rates, row counts. streams the file so it doesn't eat your ram.
kinda just built this because every time i opened a mystery csv at work i'd end up writing the same five lines of python. wanted something faster.
cargo install csvpeek
or grab a build from the releases tab.
csvpeek sales.csv
output looks like:
file: sales.csv (2.3 MB)
rows: 45,128 (streamed)
columns: 7
encoding: utf-8
# name type null% sample
1 id integer 0.0% 42, 108, 2251
2 name string 0.2% "alice", "bob", "claire"
3 price float 1.1% 19.99, 42.50, 0.00
4 is_active boolean 0.0% true, false
5 joined_at date 0.5% 2024-01-05
6 email string 4.3% "a@example.com"
7 notes string 89.2% (mostly empty)
--delimiter ,pick a different field separator (tabs, pipes, whatever)--no-headerif your file has no header row--sample-rows Ncap rows used for type inference. by default it reads all rows if the file is under 100k rows, otherwise samples 100k--jsonmachine-readable output so you can pipe it into jq or a script
integer, float, boolean, date (just YYYY-MM-DD, nothing fancy), string. if a column is a mix of int and float it widens to float. everything else mixed becomes string.
- 0 ok
- 1 file problem (not found, permissions, etc)
- 2 csv parse problem
fast feedback loop when you're staring at a random csv and wondering if that weird column is really numbers or actually a string that happens to look like numbers. helpful before loading anything into pandas or a database.
MIT. do whatever.