Skip to main content

pyreaddbc

pyreaddbc is a Python library for working with DBase database file. Legacy systems from the Brazilian Ministry of Health still uses DBF and DBC formats to Publicize data. This package was developed to help PySUS to extract data from these formats into more modern ones. Pyreaddbc can also be used to convert DBC files from any other source."

Installation

You can install pyreaddbc using pip:

pip install pyreaddbc

Usage

Note: Extracting the DBF from a DBC may require to specify the encoding of the original data, if known.

Reading DBC Files

To read a DBC file and convert it to a pandas DataFrame, use the read_dbc function:

import pyreaddbc

dfs = pyreaddbc.read_dbc("LTPI2201.dbc", encoding="iso-8859-1")

Exporting to CSV.GZ

To export a DataFrame to a compressed CSV file (CSV.GZ), you can use pandas:

import pyreaddbc

df = pyreaddbc.read_dbc("./LTPI2201.dbc", encoding="iso-8859-1")
df.to_csv("LTPI2201.csv.gz", compression="gzip", index=False)

Exporting to Parquet

To export a DataFrame to a Parquet file, you can use the pyarrow library:

import pyreaddbc
import pyarrow.parquet as pq
import pandas as pd
from pathlib import Path

# Read DBC file and convert to DataFrame
df = pyreaddbc.read_dbc("./LTPI2201.dbc", encoding="iso-8859-1")

# Export to CSV.GZ
df.to_csv("LTPI2201.csv.gz", compression="gzip", index=False)

# Export to Parquet
pq.write_table(pa.Table.from_pandas(df), "parquets/LTPI2201.parquet")

# Read the Parquet files and decode DataFrame columns
parquet_dir = Path("parquets")
parquets = parquet_dir.glob("*.parquet")

chunks_list = [
    pd.read_parquet(str(f), engine='fastparquet') for f in parquets
]

# Concatenate DataFrames
df_parquet = pd.concat(chunks_list, ignore_index=True)

License

GNU Affero General Public License (AGPL-3.0)

This license ensures that the software remains open-source and free to use, modify, and distribute while requiring that any changes or enhancements made to the codebase are also made available to the community under the same terms.

Acknowledge
============

This program decompresses .dbc files to .dbf. This code is based on the work of Mark Adler madler@alumni.caltech.edu (zlib/blast), Pablo Fonseca (https://github.com/eaglebh/blast-dbf).

PySUS has further extended and adapted this code to create pyreaddbc. The original work of Mark Adler and Pablo Fonseca is much appreciated for its contribution to this project.

Note: pyreaddbc is maintained with funding from AlertaDengue.

Metadata

Release files for pyreaddbc 2.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyreaddbc 2.0.4
File Size Uploaded
pyreaddbc-2.0.4.tar.gz 26.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyreaddbc 2.0.4
File
pyreaddbc-2.0.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pyreaddbc-2.0.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
pyreaddbc-2.0.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details
pyreaddbc-2.0.4-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pyreaddbc-2.0.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pyreaddbc-2.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
pyreaddbc-2.0.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 Details
pyreaddbc-2.0.4-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pyreaddbc-2.0.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pyreaddbc-2.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
pyreaddbc-2.0.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 Details
pyreaddbc-2.0.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
pyreaddbc-2.0.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pyreaddbc-2.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
pyreaddbc-2.0.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 Details
pyreaddbc-2.0.4-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
pyreaddbc-2.0.4-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pyreaddbc-2.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ ARM64 Details
pyreaddbc-2.0.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details
pyreaddbc-2.0.4-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 810.7 kB

Release files / pyreaddbc-2.0.4.tar.gz

Download URL pyreaddbc-2.0.4.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e3ce8f12b0feec3d6bf2b3722309346f015a22e8279f9789e9eeda869d8b33d1
BLAKE2b-256 checksum
How to use checksums
57138982e2c83d74219b969ad9018ccddcd424002830f14cceaf801a375d3cc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp313-cp313-win_amd64.whl

Download URL pyreaddbc-2.0.4-cp313-cp313-win_amd64.whl
Size 33.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
e07862c8409d69c961268d26a08c52d468ac259ab964dc2fc24822fbc790c930
BLAKE2b-256 checksum
How to use checksums
0ae74818b2c7a96951d9dc7ea6b5cda3656588848a2057add96733838c58a26c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyreaddbc-2.0.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 46.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
83ed8c757b85c6c48c3fc961edb829a75ce4ee32483a91659d5705e57c6fa3df
BLAKE2b-256 checksum
How to use checksums
db02ed73c48698cb23bb3f6303cb9b1e78b790f21dff95196262d968a23bca77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyreaddbc-2.0.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.2 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
def263c24f62a110bfb8af040df5c602e7381df9ea91e824d48a63a00917b2c5
BLAKE2b-256 checksum
How to use checksums
85dc3bc61f06a9da2f663ef3643f51f8829d8a89d0bd7295fe81adcf77f19026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp313-cp313-macosx_11_0_arm64.whl

Download URL pyreaddbc-2.0.4-cp313-cp313-macosx_11_0_arm64.whl
Size 31.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
882e4687adc47ae7702fe39fd139f27a2744feb6dc276463b761dac6d490a382
BLAKE2b-256 checksum
How to use checksums
aeeaec8e8d5b8b4bbcd4a1ae4be225495858ed47ee916b04104049e3f039d3e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp312-cp312-win_amd64.whl

Download URL pyreaddbc-2.0.4-cp312-cp312-win_amd64.whl
Size 33.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
fb47791187148753c9dd6fbf244924ff53f59db02111f9b122e0f494a8a9f6c0
BLAKE2b-256 checksum
How to use checksums
b729dde4414d0403fb814aa8c1812878f6e2d012dd01f388d33301ebaf4109be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyreaddbc-2.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 46.1 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c053370eee23ba23589369128fac5ca81a797db5e61e8bf67f1b4b325b69fa35
BLAKE2b-256 checksum
How to use checksums
2fe9f2102e044c043510e6108a93486efe1ae5657f09380f8b07f45981a5fd42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyreaddbc-2.0.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
754c1c2eb23afdad25d71edbcde0aeb8388fd297e28b094ee209c95fead6e92b
BLAKE2b-256 checksum
How to use checksums
3722ff0a5c55b3792fac65ab70a7e0804d73297b36b5647ebf3ec587ead914a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp312-cp312-macosx_11_0_arm64.whl

Download URL pyreaddbc-2.0.4-cp312-cp312-macosx_11_0_arm64.whl
Size 31.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
90dedbd59cb8cf588352610132396a74b32d4536ab718239c8cb120c0579d046
BLAKE2b-256 checksum
How to use checksums
977650615400d00f8d5d2da05705697c426af14e8ec4e8f577087c5a77fccd36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp311-cp311-win_amd64.whl

Download URL pyreaddbc-2.0.4-cp311-cp311-win_amd64.whl
Size 33.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
6396b0b0faeb64994325e59261e97f2a83dfda0727b0b719226c1af2d06556d9
BLAKE2b-256 checksum
How to use checksums
829090a40bf161a64f1aa2f108a157c3b5d0279562f39d35a11606ef82510c77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyreaddbc-2.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 46.1 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
dad1dc53137af6cc57a9f5b6d9848c5cff2df3dc0e81183c5dff80f71df7adac
BLAKE2b-256 checksum
How to use checksums
a0879bc31462a0ec1f8a9bf167821fd8c8d0d1a5b89e75071fc1c436557c8ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyreaddbc-2.0.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
55447a8ac87c7de983cbe38b1305a2bfdd5bbabeaddd4e5c7338f4643c3a8770
BLAKE2b-256 checksum
How to use checksums
2429c1bcadf3b24787b50cdd7ed83f9b2ce6131c9963c2b374800f38e3b3410a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL pyreaddbc-2.0.4-cp311-cp311-macosx_11_0_arm64.whl
Size 31.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b469ee9442ba93d1a81ca37851082303fbe63dd9d4c63a4285deaf452c790038
BLAKE2b-256 checksum
How to use checksums
d570fc339d7014d969c2cb06b2ee1ad057f4c77f16aea93e284f2daccbbacbbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp310-cp310-win_amd64.whl

Download URL pyreaddbc-2.0.4-cp310-cp310-win_amd64.whl
Size 33.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
a09a7d11000315d007486e23e5291820dd0144916c3faa2aae79a7a5a625ca32
BLAKE2b-256 checksum
How to use checksums
5dc74ba148ff809e17638a8225df2237b340d217b102e2a7fa9939f37f29d3b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyreaddbc-2.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 46.1 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
eb6bb262e3d7445b2cefefafe5bc9d78f993ee58830e830a0cf172438647a8c5
BLAKE2b-256 checksum
How to use checksums
199aff832de161a22682186fee3d92b51e597344ca9a0a0a24010554845307d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyreaddbc-2.0.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
51d2458a0a9b4fb6017558051ed360aa9ed7cdef0f6feaeaf0687cb5a6e37cbb
BLAKE2b-256 checksum
How to use checksums
09fb3c12573c9a8e300ce4fc238be6cedddcd6f45e40cef0c31d530f21d0fda0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp310-cp310-macosx_11_0_arm64.whl

Download URL pyreaddbc-2.0.4-cp310-cp310-macosx_11_0_arm64.whl
Size 31.5 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a45d4aa2be0173e0bccee64e76847e96a02fcdd02cb449be92e99b0a76f8f0f8
BLAKE2b-256 checksum
How to use checksums
9ef3dae6cf2ff5462af1e9e6db8a8e8867eb39bc768665d68871a7f9d39844d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp39-cp39-win_amd64.whl

Download URL pyreaddbc-2.0.4-cp39-cp39-win_amd64.whl
Size 33.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
bab1a14feaf39aff81527d93a74a218af83235509e7782ec4a26ed746b40c200
BLAKE2b-256 checksum
How to use checksums
a17529c6b8b2ed7fc6723cc764b14ad181a5b8079ebc18814aae96fce9fcf0ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyreaddbc-2.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 45.9 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
6ae84f224b3a3b4d80c4450ded13425347d7d2ad8b4bd08399e2f7a00b22ae92
BLAKE2b-256 checksum
How to use checksums
8436bbf926a9fedafcf6b49f372039ce056fea976a890d66d0a59cee78f13ebf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyreaddbc-2.0.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
854674fc5f9728c8296fb787dba0bcc00affdd6b227cc9173d401275f16d01e2
BLAKE2b-256 checksum
How to use checksums
276a8ed9741511dfca231ad13b5447408a394d13c337dfe39fde7e14e2cea451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pyreaddbc-2.0.4-cp39-cp39-macosx_11_0_arm64.whl

Download URL pyreaddbc-2.0.4-cp39-cp39-macosx_11_0_arm64.whl
Size 31.5 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
56a1ad297dda409d0af68349a5b26cb1e61f158e11046a7d7387a6b140913fc6
BLAKE2b-256 checksum
How to use checksums
98580a5f487f471746555195ace08c25aafe77fcf9425e4313817f5862345971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

2.0.4 This release

21 release files

2.0.3

21 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page