Skip to main content

clean CSVs

Project description

clean your CSVs!

This command line tool cleans CSV files by:

  1. detecting the encoding and converting it to utf-8
  2. detecting the delimiter and safely converting it to a comma
  3. casting all variables to json form, i.e. integers, floats, booleans, string or null.
  • install pip install csv-bleach
  • and run like python -m run csv_bleach my-data.csv

The only option is the output file name, by default it will be your original file name with .scsv extension.

You will now be able to parse your CSV safely with a simple script like:

import json


def parse_row(text):
    return json.loads(f"[{text}]")

def parse_file(file):
    rows = map(parse_row, file)
    header = next(rows)
    for row in rows:
        yield dict(zip(header, row))


with open("my-data.scsv") as f:
    for item in parse_file(f):
        print(item)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csv_bleach-0.2.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

csv_bleach-0.2.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file csv_bleach-0.2.3.tar.gz.

File metadata

  • Download URL: csv_bleach-0.2.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1031-azure

File hashes

Hashes for csv_bleach-0.2.3.tar.gz
Algorithm Hash digest
SHA256 1b14cdf085c252240ccf3fab8d7a396952d492cb3181eb8cdf58ce357c7f778b
MD5 976bc39fb0007b317137cc29800a7ef6
BLAKE2b-256 2d470f9e2af34700c2048509dfa4e35706f37de565a456bb2211072eb40a2d03

See more details on using hashes here.

File details

Details for the file csv_bleach-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: csv_bleach-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1031-azure

File hashes

Hashes for csv_bleach-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2e021b2c8142d0b083dbabb7b9b77203e5f4d0e3b10f5cfe11d712a67ecb6de4
MD5 9163f975188407aea5b9e52e497d2237
BLAKE2b-256 29981af97c4e20e22367334a0d0a352a6d2f7035f3df578dcefeecf71ad45f50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page