Skip to main content

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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbfrs-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl (408.0 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for dbfrs-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2c538b069a470600113b35a14b0206dc2321919b6a52cf821efcdb24af46f79d
MD5 4cff5dbb42e30fba6cba2b29378df178
BLAKE2b-256 c9f2e35377210ccba2cd81e59da98a5deb8361c0d56bfbbccbe17f8bc10d18dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dbfrs-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ad7f57e175e59439dc228d1ca55a0c14d3846d7afbf659599684cb4cf5d9a0d7
MD5 906787bf90b1e5416f8d5187719dca70
BLAKE2b-256 cd19b2aefbb20519f35dc81b151c77a70612311b339b3d0bf03303fd32487fd8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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