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.

A pypi build is not available yet so:

  • checkout the code
  • build it poetry build
  • and run like poetry run 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: str) -> list:
    return json.loads(f"[{text}]")


with open("my-data.scsv") as f:
    header, *rows = map(parse_row, f)
    for row in rows:
        print(dict(zip(header, row)))

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.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

csv_bleach-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: csv_bleach-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.4.0-136-generic

File hashes

Hashes for csv_bleach-0.1.1.tar.gz
Algorithm Hash digest
SHA256 65f2a37e81fb4df0a39b550dd66bbe0b9293f48d4d55b63672c3d7cd83b5c882
MD5 c8dde05299f7f2417c5647ef3098f5e1
BLAKE2b-256 ab9e139e257a8e7e8398fb68c3cc7908c3d41f648aa7987846c8c7e833d366b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csv_bleach-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.4.0-136-generic

File hashes

Hashes for csv_bleach-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d91f7a193abefe2d12234651712e1ed5f005786ccde204a93d650470513b9b2
MD5 9014dcd1c0dc53125532f998c0a2db58
BLAKE2b-256 00863cd9c957fd7dbf6cd061e992a8877ad99f898c10447b064c7a5ffc96e429

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