No project description provided
Project description
dbfrs
Minimalist DBF reader and writer for Python 3 written in Rust. The state of DBF libraries in 2024 is abysmal, yet still companies rely on this format. This library aims to provide a simple, easy-to-use interface for reading and writing DBF files.
Most libraries are either outdated, have a lot of dependencies, are too complex, or a really slow.
Most of them offer only reading capabilities. The main focus of dbfrs
is to be minimalistic and fast.
Installation
pip install dbfrs
Usage
Reading a file
import dbfrs
import pandas as pd
filename = 'file.dbf'
records = dbfrs.load_dbf(filename)
Reading a file into a DataFrame, only loading specific fields
import dbfrs
import pandas as pd
filename = 'file.dbf'
fields = dbfrs.get_dbf_fields(filename)
records = dbfrs.load_dbf(filename, fields)
df = pd.DataFrame(records, columns=fields)
Writing a DataFrame to a file
import dbfrs
import pandas as pd
filename = 'file.dbf'
df = pd.DataFrame({'field1': [1, 2, 3], 'field2': ['a', 'b', 'c']})
fields = dbfrs.Fields()
fields.add_numeric_field('field1', 'N', 10, 0)
fields.add_character_field('field2', 'C')
records = [tuple(x) for x in df.values.tolist()]
dbfrs.write_dbf(filename, fields, records)
Development
Building the Rust library
maturin build
Publish a new version
maturin publish
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
dbfrs-0.1.3.tar.gz
(8.8 kB
view details)
Built Distribution
File details
Details for the file dbfrs-0.1.3.tar.gz
.
File metadata
- Download URL: dbfrs-0.1.3.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 459dbfad1f2c3f8c15dcb574669fc87c26ac03779c3c99c8692ba060251d60bf |
|
MD5 | 71c4ec62c0d9bd97f6052a7b80dbb983 |
|
BLAKE2b-256 | ef5ae70ada8e991252724840cfdf561a7c030125f496c58d02c5d976b151c313 |
File details
Details for the file dbfrs-0.1.3-cp310-abi3-manylinux_2_34_x86_64.whl
.
File metadata
- Download URL: dbfrs-0.1.3-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 356.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b48ff456c6731523a01d7b262c31c2a378171ab226fd44ac36ad13488afe248 |
|
MD5 | f5c7d2a5159ccca342761fdd0d6b6cb2 |
|
BLAKE2b-256 | 9e5d0419e65d4fc0e33b6d2e76b6e7c5f3b3ede279e6d23ed59976911704f93a |