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 into a DataFrame
import dbfrs
import pandas as pd
filename = 'file.dbf'
fields = dbfrs.get_fields_from_file(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_field('field1', 'N', 10)
fields.add_field('field2', 'C', 10)
records = [tuple(x) for x in df.values.tolist()]
dbfrs.write_dbf(filename, fields, records)
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.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file dbfrs-0.1.1.tar.gz
.
File metadata
- Download URL: dbfrs-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75a9e2dd3123560d18b5b7876a2aaca3959a676697196bb565c6d8574ab3ef32 |
|
MD5 | 96b11f5dc784e32105d16e467cd901f4 |
|
BLAKE2b-256 | ca5716341f405b4d543168595db58b7ae2ad3cc2dfb9b8b2453c548dedd502fa |
File details
Details for the file dbfrs-0.1.1-cp310-abi3-manylinux_2_34_x86_64.whl
.
File metadata
- Download URL: dbfrs-0.1.1-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 349.5 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 | 7b4df24ba006e7a911ce1abc6380abb7e0c339cd7a2d377bffbd310c5cab91e6 |
|
MD5 | 6f2e41a3d3f67abbf88666d10bae4402 |
|
BLAKE2b-256 | 5634d6f049ba6b86b1ded5035ba50de331e42d8c6d14fb9698f46dc1080cea5f |