Metadata-Version: 2.1
Name: csv_bleach
Version: 2.4.0
Summary: clean CSVs
Home-page: https://github.com/gecBurton/csv-bleach
License: MIT
Keywords: csv
Author: George Burton
Author-email: g.e.c.burton@gmail.com
Requires-Python: >=3.9.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing
Requires-Dist: charset-normalizer (<=3.3.0)
Requires-Dist: click (>=8.1.3,<9.0.0)
Project-URL: Repository, https://github.com/gecBurton/csv-bleach
Description-Content-Type: text/markdown

# clean your CSVs!

This command line tool cleans CSV files by:
1. converting encoding 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 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:

```python
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)
```

