Skip to main content

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.3 - 09.01.2020

  • fix: detection of boolean

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

mds_csv_reader-1.0.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

mds_csv_reader-1.0.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file mds_csv_reader-1.0.3.tar.gz.

File metadata

  • Download URL: mds_csv_reader-1.0.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for mds_csv_reader-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5812f4c94c549e91681246dbbbf44fabcf6a6be41d9dba298c943a39974972e8
MD5 0f7364898f157da8bd9f0048537c9a20
BLAKE2b-256 60b4c486f96fecd5e4f1a11043067d913c372b37fb23f2942a7769b8dacc681a

See more details on using hashes here.

File details

Details for the file mds_csv_reader-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: mds_csv_reader-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for mds_csv_reader-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 110e8323b28d3a43f576213d73f68bd8d21d271a0e3cc47c5830d8535d6076e4
MD5 d4734a609c2c45ae101c4159cacc4263
BLAKE2b-256 7553ded2f772eca6fca65e91f86e81708cb9adf0e312e47bbdc90cbd1d581d75

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