Skip to content

f4rkh4d/csvpeek

csvpeek

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.

install

cargo install csvpeek

or grab a build from the releases tab.

usage

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)

flags

  • --delimiter , pick a different field separator (tabs, pipes, whatever)
  • --no-header if your file has no header row
  • --sample-rows N cap rows used for type inference. by default it reads all rows if the file is under 100k rows, otherwise samples 100k
  • --json machine-readable output so you can pipe it into jq or a script

types it tries to guess

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.

exit codes

  • 0 ok
  • 1 file problem (not found, permissions, etc)
  • 2 csv parse problem

why

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.

license

MIT. do whatever.

About

inspect csv files fast — column types, null rates, row counts. rust, single binary.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages