Converts files from CSV to JSON formats and vice-versa.
This is meant to be used as the final project for the Python course from the Artificial Intelligence program at PUC Minas.
It has nothing groundbreaking, so you should safely ignore it. In any case, if you managed to get here, feel free to check my other (hopefully) more useful projects:
Python TSP: a TSP solver;
Python Kanban: a Kanban board for the command line.
Installation
pip install file-converter-fgsm
This assumes you are inside a virtual environment. If you wish to install it globally on the system (which I do not recommend for this class project), add sudo at the beginning.
Usage
Once installed, a file_converter command becomes available.
Type
file_converter --help
to get further help.
Examples
Converting a single file
Suppose you have a file sample_file.csv in the current directory with the contents
header1,header2,header3,header4
1,a,1.5,
2,b,3.2,info
To convert it into a json format, run
file_converter --conversion=csv2json --input_path=./sample_file.csv
and then you should have a sample_file.json in the same directory with the contents:
[
{
"header1": 1,
"header2": "a",
"header3": 1.5,
"header4": null
},
{
"header1": 2,
"header2": "b",
"header3": 3.2,
"header4": "info"
}
]
Notice how the missing info became null and each type was properly parsed.
The previous command is short for
file_converter --conversion=csv2json --input_path=./sample_file.csv --output_path=. --separator=, --prefix=""
Experiment running again but with a different --output_path.
The command supports the other way for the conversion as well. To test that, let us convert the recently converted json file but prefixing the resulting file name with a new_:
file_converter --conversion=json2csv --input_path=./sample_file.json --prefix="new_"
Notice the csv2json became json2csv in the --conversion attribute. Also, we should have a new_sample_file.csv with the same contents of the first.
Converting all files in a folder
If instead of a single file path you pass a folder in the --input_path parameter, the command will attempt to convert all files inside of it. Notice they all should have the same separator.
Experiment passing the current directory like
file_converter --conversion=csv2json --input_path=. --prefix="from_folder_"
If you followed the previous example, you should have two new json files starting with from_folder_.
Metadata
Release files for file-converter-fgsm 0.1.3
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 | |
|---|---|---|---|---|
| file-converter-fgsm-0.1.3.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| file_converter_fgsm-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / file-converter-fgsm-0.1.3.tar.gz
| Download URL | file-converter-fgsm-0.1.3.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f3eabe24e2f2c21fde4099a56efaeefae0af00e552c9fbd6edb6da178b4fc05
|
|
BLAKE2b-256 checksum How to use checksums |
2524bbffe07e31952fdb0620b19074371571572f250a36cadf7f231f8ab2c806
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Linux/5.13.19-2-MANJARO
|
Release files / file_converter_fgsm-0.1.3-py3-none-any.whl
| Download URL | file_converter_fgsm-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9091cd9267ecf74a252dfca10ba9f9b375a51ef2c664c225252fe49f8e8b79c2
|
|
BLAKE2b-256 checksum How to use checksums |
0dca337854199784b16880bf57f3a3be903bb2276c486a72136b7a49ff425ec7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Linux/5.13.19-2-MANJARO
|
Security for file-converter-fgsm 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.