csvkey
For a very limited situation such that you don't need performance and want to use CSV as database.
Example
from csvkey import Connection
import pandas as pd
import numpy as np
# prepare DataFrame
data = pd.DataFrame()
data['A'] = pd.Series([1,2,3], dtype='int')
data['B'] = pd.Series([4,5,6], dtype='float32')
data['C'] = pd.Series([7,8,9], dtype='float64')
# register database
conn = Connection()
conn.initialize(data, r'C:\TEST\database.csv',
primary=['A', 'B'],
unique=['C'],
notnull=['C'])
# database.csv and the configuration file (default: csv.conf) are generated in C:\TEST\
# set 'A' and 'B' columns as a primary key
# values in 'C' column must be unique and not NaN
# connect to database.csv
conn.connect(r'C:\TEST\database.csv')
conn.df.dtypes # dtypes are preserved
# change values in conn.df
conn.df.loc[0, 'C'] = 8
conn.commit() # raise ValueError because 8 is not unique
conn.df.loc[0, 'C'] = np.nan
conn.commit() # raise ValueError because NaN is not allowed in 'C'
conn.df.loc[0, 'C'] = -1
conn.commit() # OK
conn.df.loc[2, ['A', 'B']] = [1, 4]
conn.commit() # raise ValueError because primary keys are duplicated
Installation
pip install csvkey
Requirements
pandas
pyyaml
Metadata
Release files for csvkey 0.0.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 | Actions |
|---|---|---|---|---|
| csvkey-0.0.3.tar.gz | 2.9 kB | Without provenance | Details for csvkey-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| csvkey-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for csvkey-0.0.3-py3-none-any.whl |
Total release size: 7.0 kB
Release files / csvkey-0.0.3.tar.gz
| Download URL | csvkey-0.0.3.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ae3612b7066066ea541832a4500c48ab2b023d72dfa0a964b478f80303f4eb0
|
|
BLAKE2b-256 checksum How to use checksums |
94037fbe2996fc8426c5595eff5709f643331cc74d47a73a1d7274dfc5ac60d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|
Release files / csvkey-0.0.3-py3-none-any.whl
| Download URL | csvkey-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ba6bcbee85cc0b957a747bad69f36b35d1abe7bc1831d5f84833e2dd2bca0ea
|
|
BLAKE2b-256 checksum How to use checksums |
82bb70dae2dabf053bbc29b3ac065d839fce27ebd63eeb7b325b9397a4a44e3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|
Security for csvkey 0.0.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.