DEV Community

Robin Beraud-Sudreau
Robin Beraud-Sudreau

Posted on

Know What's in a CSV Before You Touch It: A One-File Profiler

You get a CSV export. Before cleaning, importing or charting it, you want answers to boring questions. Which columns are mostly empty? Are there duplicate rows? Is that price of 2000 among values near 100 a typo? Opening it in a spreadsheet works for small files, but it is slow to repeat and hard to share.

I wrote a Hermes skill, csv-quick-insights, built around one Python file that uses only the standard library. No pandas, no install, no API key. It auto-detects the delimiter, infers a type for each column (integer, float, date, boolean, category, text), counts missing values, flags duplicate rows and ragged lines, and marks numeric outliers with the 1.5 x IQR rule. It then draws three text charts: missing values per column, a histogram of the first numeric column, and the top values of the first categorical one.

python3 scripts/csv_insights.py data.csv
Enter fullscreen mode Exit fullscreen mode
Rows: 8  Columns: 6  Delimiter: ,
Duplicate rows: 1
- price [integer] missing=2 (25.0%) min=95 median=102.5 max=2000 outliers=1
- city [category] top=Paris:5, Lyon:2, Nice:1
Enter fullscreen mode Exit fullscreen mode

There is also --json for piping into other tools and --selftest to check the script itself.

It is a heuristic profiler, not a validator: numeric codes like zip codes will look like integers, and decimal commas are not parsed. It is meant to give you a first honest look and a list of things to check.


Skill (MIT): https://github.com/RobinBeraud/hermes-skills/tree/main/data-analysis/csv-quick-insights
All skills: https://github.com/RobinBeraud/hermes-skills

This post was written with AI assistance and reviewed through automated checks.

Top comments (0)