skillfed

clevercsv

A Python package for handling messy CSV files

clevercsv v0.8.5 461.1K downloads/30d#6,535 on PyPI1,332
Permissive license MIT Active released

What it is and what it does

CleverCSV is a Python library that automatically detects the dialect (delimiter, quote character, escape character, etc.) of CSV files using pattern-based machine learning trained on real-world data. It wraps the standard library's csv module with improved dialect detection and adds convenience functions like read_table(), read_dataframe(), and read_dicts() that handle dialect and encoding detection automatically. The package also includes a command-line tool for detecting dialects, generating Python import code, and exploring CSV files interactively.

The core problem it solves is the brittleness of manual CSV parsing: the Python csv module's Sniffer often fails on non-standard or messy files because it has no way to distinguish between valid but unusual dialects. CleverCSV uses row-length patterns and inferred data types to make more robust decisions, achieving high accuracy even on files with inconsistent formatting, missing headers, or unusual delimiters.

Use it for:

  • Automatically import a CSV file without manual dialect inspection or trial-and-error parameter tuning.
  • Batch-process a directory of CSV files with varying formats and detect each one's dialect programmatically.
  • Generate boilerplate Python code to import a messy CSV file, then integrate it into a data pipeline.
  • Use the command-line tool to standardize or explore a CSV file before loading it into a database or data analysis tool.
  • Handle CSV files from external sources where format is unknown or inconsistent.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

CleverCSV detects CSV file dialects automatically and provides a drop-in replacement for Python's csv module, plus a command-line tool for standardizing messy CSV files and generating import code.

Yes. CleverCSV is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and solves a real problem—automatic dialect detection for messy CSV files. The package shows solid adoption with 1332 GitHub stars. Install friction is medium but manageable. It's worth installing if you regularly work with CSV files from untrusted or varied sources, or if you want to avoid manual dialect inspection.

Install

clevercsv on PyPI

pip

pip install clevercsv

uv

uv add clevercsv

poetry

poetry add clevercsv

Installing clevercsv

Before you install

Medium install friction due to compiled wheels across multiple Python versions and platforms. Package is actively maintained with recent releases; last commit 2026-08-10, 1332 GitHub stars, and no known vulnerabilities.

License in practice

MIT license is permissive; you may use, modify, and distribute CleverCSV freely in commercial and private projects with minimal restrictions.

Quickstart

pip install clevercsv

import clevercsv

# Detect dialect and read as list of rows
rows = clevercsv.read_table('./messy.csv')

# Or use as drop-in for csv module
with open('./messy.csv', newline='') as f:
    dialect = clevercsv.Sniffer().sniff(f.read())
    f.seek(0)
    reader = clevercsv.reader(f, dialect)

Verify before relying

  • Accuracy claim of 97% for dialect detection and 21% improvement on non-standard files—based on research paper but not independently verified in this fact sheet.
  • Performance characteristics (speed, memory usage) for large CSV files—not documented in the fact sheet.
  • Behavior when dialect detection fails or is ambiguous—fallback strategy not specified.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9.0)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — chardet, regex, packaging
Maintenance actively maintained — 95 days since the last release
Last repo commit
First released
Downloads 461,088/month — #6,535 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: clevercsv-0.8.5-cp310-cp310-macosx_10_9_universal2.whl; clevercsv-0.8.5-cp310-cp310-macosx_10_9_x86_64.whl; clevercsv-0.8.5-cp310-cp310-macosx_11_0_arm64.whl; clevercsv-0.8.5-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; clevercsv-0.8.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clevercsv-0.8.5-cp310-cp310-win_amd64.whl; clevercsv-0.8.5-cp311-cp311-macosx_10_9_universal2.whl; clevercsv-0.8.5-cp311-cp311-macosx_10_9_x86_64.whl; clevercsv-0.8.5-cp311-cp311-macosx_11_0_arm64.whl; clevercsv-0.8.5-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; clevercsv-0.8.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clevercsv-0.8.5-cp311-cp311-win_amd64.whl; clevercsv-0.8.5-cp312-cp312-macosx_10_13_universal2.whl; clevercsv-0.8.5-cp312-cp312-macosx_10_13_x86_64.whl; clevercsv-0.8.5-cp312-cp312-macosx_11_0_arm64.whl; clevercsv-0.8.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; clevercsv-0.8.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clevercsv-0.8.5-cp312-cp312-win_amd64.whl; clevercsv-0.8.5-cp313-cp313-macosx_10_13_universal2.whl; clevercsv-0.8.5-cp313-cp313-macosx_10_13_x86_64.whl

Keywords: csv

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

csv dialect detectionmessy csv parsingautomatic csv format detectioncsv sniffer replacementcsv standardization toolrobust csv readercsv encoding detection
csv-parsingdata-wranglingcli-tool

More Text Processing packages