incisive
incisive is a tiny library for handling CSV in Python. It’s a wrapper for the csv module.
Usage
You can read a csv file like this:
>>> iris = read_csv("data/iris.csv") >>> iris.next() {'petal_length': 1.4, 'petal_width': 0.2, 'sepal_length': 5.1, 'sepal_width': 3.5, 'species': 'setosa'}
read_csv returns a generator. Note that incisive, by default, tries to guess the type of the columns.
Writing a CSV file can be done in two ways:
with a list of dictionaries:
>>> data = [{'name': 'Lancelot', 'actor': 'John Cleese', 'color': 'blue'}, {'name': 'Galahad', 'actor': 'Michael Palin', 'color': 'yellow'}] >>> write_csv('bridge.csv', ('name', 'actor', 'color'), data=data)
(the keys are the field names of the CSV file.)
or with just a list of rows:
>>> rows = [('Lancelot', 'John Cleese', 'blue'), ('Galahad', 'Michael Palin', 'yellow')] >>> write_csv('bridge.csv', ('name', 'actor', 'color'), rows=rows)
Note that this second method requires that your field names correspond exactly to the elements of your rows.
Features
Simple API
Guess the types when it’s possible
Accept functions to specify the types
Metadata
Release files for incisive 0.1.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 |
|---|---|---|---|---|
| incisive-0.1.0.tar.gz | 3.4 kB | Without provenance | Details for incisive-0.1.0.tar.gz |
Release files / incisive-0.1.0.tar.gz
| Download URL | incisive-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07606757ecc757bb714eddb9f349f9d030e3e7e0191b3168fea9a153778ccfb9
|
|
BLAKE2b-256 checksum How to use checksums |
827c9d9d6c85e3d1989b55c443f1a9c9c59bca8ef0a2d63a60d217c93d32f472
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for incisive 0.1.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.
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.