Skip to main content

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.4.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

dbfrs-0.1.4-cp310-abi3-manylinux_2_34_x86_64.whl (409.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

File details

Details for the file dbfrs-0.1.4.tar.gz.

File metadata

  • Download URL: dbfrs-0.1.4.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.5.1

File hashes

Hashes for dbfrs-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e4d7bf4f80b1f9a9125cefbdbd5648c0f3ec2d98a78603b520922a8b2c2088f9
MD5 b9276c89c97f1392fe2e6708c25a05a5
BLAKE2b-256 301f067eeab9cd4849445e6dc81695b6177970b0ef8bf7bf190ffd63b02ff076

See more details on using hashes here.

File details

Details for the file dbfrs-0.1.4-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dbfrs-0.1.4-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7c3d8475c6ee4fb68311a3f02ddea8bfa32659d778c691e8d607d77ed5b6acfd
MD5 d149fbb33b0b20bd98501a3f57c447ec
BLAKE2b-256 5f33c33872fede5bbac54f854a5f70915a93a6bbf7a98c89790f31e1510d6ffc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page