csv_fix
Instruction
This script uses state machine to fix maleformed csv file.
Usage: csv_fix.py [Options] <filename>
Options and arguments:
[-h/--help]: Show this message.
[-s]: Define sperator. Defaults to comma.
[-q]: Define text qualifier. Defaults to auto detect.
[-t]: Trim white space at the beginning and end of each field. Defaults to double quote.
[-z]: (Being constructed) Specify timezone for time fields. Defaults to server timezone. Can also be Asia/Chongqing etc.
For standard timezone names, refer to: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
[-k]: Skip errors and continue parsing following lines.
<filename>: csv file name.
Examples
# Input from stdin
cat test_case.csv | csv_fix
# Input from file
csv_fix -t test_case.csv
The processed output will be written to stdout.
Features
Fix Malformed CSV
Try to fix the format whenever possible. You can find test cases in ./tests/.
The script follow this state machine to fix possible errors:
Trim White Space
For fields that begin/end with white space can be stripped by specifying -t.
echo -n ' red, yellow,green ,"red "' | csv_fix -t
# Output: "red","yellow","green","red"
Customize Seperator
Seperator can be customized. Specify seperator by -s.
echo -n 'A 27" monitor|"This should be good.|"|"' | csv_fix -s '|'
# Output: "A 27"" monitor"|"This should be good.|"|""
Customize Qualifier
Qualifier can be customized. Specify qualifier by -q.
echo -n "'hello, what's up!','Not bad!'" | csv_fix -q "'"
# Output 'hello, what''s up!','Not bad!'
Metadata
Release files for csv-fix 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| csv_fix-0.3.0.tar.gz | 10.4 kB | With provenance | Details for csv_fix-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| csv_fix-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for csv_fix-0.3.0-py3-none-any.whl |
Total release size: 20.2 kB
Release files / csv_fix-0.3.0.tar.gz
| Download URL | csv_fix-0.3.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87b4c6a619b648aafdaa4a4a17fa176d5b88def5f825b76fdfbf0c7102b50935
|
|
BLAKE2b-256 checksum How to use checksums |
83c702e7aeb658e62857df4a54892c1fca88a8b8be669b5cf1955f7a11a518cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.
Transparency logRelease files / csv_fix-0.3.0-py3-none-any.whl
| Download URL | csv_fix-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00b54b4d415bf34c42411532ae9882894bd4e5a10647bfb8bb989aae15aefbd7
|
|
BLAKE2b-256 checksum How to use checksums |
b4da98d8d25fb5c15045289e8878b1bee9c4e52afbd4c38ef5f586ecbc676a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.
Transparency logSecurity for csv-fix 0.3.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for csv_fix-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.
Transparency logA 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.