See what pandas and DuckDB do to the same CSV. Inspect the values, inferred types and record counts alongside the original CSV text.
Download the example HTML report
Clone this repository and run the following from its root with Python 3.10+.
python -m pip install .
csvscope examples/orders.csv --key order_id --html report.htmlIn the sample, pandas turns 01001 into 1001 and reads the literal NA as null. Open report.html to compare the results with the CSV text and filter by reader, column, key or value. The report works offline.
csvscope sales.csv
csvscope export.tsv --delimiter tab --key source --key order_id
csvscope sales.csv --format json --fail-on-diff- By default, pandas and the text reader expect comma-separated UTF-8 with a header. DuckDB detects the dialect and header. Use
--delimiterto set the delimiter for all three readers. With--no-header, columns are namedcolumn_1,column_2, and so on. - Records are compared by position when the counts match. Use
--keyto match records across a count or order change. Key components are compared as text and must be nonempty and unique together in each reader. Choose an ID that keeps its spelling on import. - Values are compared in shared, unambiguous columns. The text check compares the decoded field with the imported value's spelling. It can flag formatting changes such as
2.00becoming2.0. Engine types are compared by family, soint64andBIGINTagree. - Counts cover the entire file.
--limitcaps examples per check and reader pair. Positional comparison streams CSV text and fetches DuckDB rows in batches. pandas holds its DataFrame in memory. Key alignment also stores records in memory.
Exit status is 0 for a completed report, 1 for findings with --fail-on-diff, and 2 for a read, key or usage error.
csvscope examples/dialect.csv
csvscope examples/dialect.csv --delimiter ","With DuckDB 2.0.1, dialect detection reads zero records in this single-column sample. With the comma set explicitly, all readers return two records. DuckDB issue #25827
csv-spectrum has parser fixtures. csv-diff compares two files. csvscope reads one file with both engines and checks what each import returned.
python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check .