Convert csv-file to list of dictinaries
Project description
mds-csv-reader
Read a csv-file, converts to list of dictionaries.
Install
pip install mds-csv-reader
Howto
Syntax
import_csv_file(
csvfile, # file or string
firstline=True, # first line contains column names
decimalremove=['€', 'EUR', '.'], # remove these strings from decimal columns
ignline=[1, 2, ...], # skip these lines
ignore_leer=['<column nam>',...], # ignore empty values in these columns
encod='utf-8', # encoding if 'csvfile' is byte type
)
Column names
column names must contain field type info
allowed types: C, D, DT, T, N, L
Example
- NAME1,C
type String
- CREATEDATE,D,%Y-%m-%d
type Date, detection tries defined format
- CREATEDATE,D
type Date, detection tries predefines formats
- DATETIME,DT,%Y-%m-%d %H:%M
type DateTime, detection tries defined format
- DATETIME,DT
type DateTime, detection tries predefines formats
- CREATETIME,T,%H:%M
type Time, detection tries defined format
- CREATETIME,T
type Time, detection tries predefines formats
- NUMSTEP,N,10,0
type Numeric (no decimals) –> Integer
- AMOUNT,N,16,2
type Numeric (two decimals) –> Decimal
- ISENABLED,L
Boolean (allowed: true, false, t, f, wahr, falsch, 1, 0)
- default-type: String
if convert to requested type fails
Changes
1.0.5 - 28.07.2023
code optimized
1.0.4 - 09.01.2020
fix: detection of boolean, import of csv-text-data
1.0.2 - 20.12.2019
exteded detection of date and time formats
1.0.0 - 17.12.2019
optimized detection of formatting in csv-file
1.0.0 - 17.12.2019
first public version
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mds_csv_reader-1.0.5.tar.gz.
File metadata
- Download URL: mds_csv_reader-1.0.5.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f622e7a8335ece3e93e4fb9d0019bb41c274f2fe90d96b143b4bd763e9a265b3
|
|
| MD5 |
ff5bd024a818940e3a575af84ae97b05
|
|
| BLAKE2b-256 |
4561be55b55321ddfd97e542d4d887c72aace938d0813d385f3d4d1c02a05b72
|
File details
Details for the file mds_csv_reader-1.0.5-py3-none-any.whl.
File metadata
- Download URL: mds_csv_reader-1.0.5-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d225304a8c7e63c065194294a26a681b0eb6fedd6fc5ced55cec362e59b6ce8b
|
|
| MD5 |
0f050ca0aa6efc50d8721097ca130aa5
|
|
| BLAKE2b-256 |
25f83c327ce2f6f97801e32c3d30eb099c44537fc8a9f2e5cd44b620d314ec6d
|