Skip to main content

csvmedic

PyPI Python License

One-line CSV reading that auto-detects encoding, delimiter, dates, number formats, and booleans—so you don’t lose leading zeros or misinterpret 03/04/2025.

import csvmedic

df = csvmedic.read("export.csv")
print(df.diagnosis)  # What was detected and converted

csvmedic demo

Features

Detects Examples
Encoding UTF-8, Windows-1252, ISO-8859-1, Shift-JIS, BOM
Delimiter Comma, semicolon, tab, pipe
Dates DD-MM vs MM-DD resolved from data; ISO, European, US formats
Numbers European (1.234,56) vs US (1,234.56)
Booleans Yes/No, Ja/Nein, Oui/Non, Sí/No, and more
Strings Preserves leading zeros (e.g. IDs 00742)

All decisions are recorded on the returned DataFrame’s .diagnosis attribute.

Installation

pip install csvmedic

Optional extras:

  • csvmedic[fast] — better dialect detection (clevercsv)
  • csvmedic[excel] — .xlsx support (openpyxl)
  • csvmedic[all] — both

Usage

Override detection when you know better:

df = csvmedic.read(
    "file.csv",
    encoding="utf-8",
    delimiter=";",
    dayfirst=True,
    preserve_strings=["ID"],
    confidence_threshold=0.75,
)

Inspect without converting:

profile = csvmedic.read_raw("file.csv")
print(profile.summary())

Schema pinning (recurring files):

df = csvmedic.read("monthly_export.csv")
csvmedic.save_schema(df.attrs["diagnosis"].file_profile, "monthly_export.csvmedic.json")
# Next run: skip detection
df2 = csvmedic.read("monthly_export.csv", schema="monthly_export.csvmedic.json")

Batch with consensus:

dfs = csvmedic.read_batch(["jan.csv", "feb.csv", "mar.csv"], use_consensus=True)

Compare with pandas:

result = csvmedic.diff("file.csv")
print(result.summary())
# result.pandas_df, result.csvmedic_df, result.sample_differences

Date disambiguation

For ambiguous values like 03/04/2025, csvmedic uses the column: if any value has day > 12 (e.g. 25/03/2025), the column is treated as day-first. It also uses cross-column inference, separator hints (e.g. period → European), and order. If still ambiguous, the column stays as string and is marked in the diagnosis.

Documentation

License

MIT

Metadata

Release files for csvmedic 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csvmedic 0.1.3
File Size Uploaded Provenance Actions
csvmedic-0.1.3.tar.gz 21.1 kB Without provenance Details for csvmedic-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for csvmedic 0.1.3
File Interpreter ABI Platform Actions
csvmedic-0.1.3-py3-none-any.whl Python 3 none any Details for csvmedic-0.1.3-py3-none-any.whl

Total release size: 50.8 kB

Release files / csvmedic-0.1.3.tar.gz

Download URL csvmedic-0.1.3.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
138b2f641f828cdd9ab2159f9d5ebd1f1ea1d51ba635b5c073441b20dd4f3d30
BLAKE2b-256 checksum
How to use checksums
508d9b7d491ecf2fd4fbfa6e410826aa5a5f1f2b3e21bef69b2147ab438093ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / csvmedic-0.1.3-py3-none-any.whl

Download URL csvmedic-0.1.3-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42ee57a3ce4952ceced6211365d05106d04b3914c77e134c2179508a707a88ab
BLAKE2b-256 checksum
How to use checksums
dd8a24f89e92aeca3a463585a23e0b7ddd5ab33ebf228c97e3dc0fbb9524e594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for csvmedic 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page