fdth
Frequency distribution tables, histograms, and polygons for numerical and categorical data in Python.
A feature-complete port of the fdth R package (CRAN).
pip install fdth
Until the package is published on PyPI, install from GitHub (source):
pip install git+https://github.com/jcfaria/fdth-python-fork_2026.1.gitOr install the built wheel from this repository’s
dist/folder (project exception — artifacts are versioned on purpose):pip install https://github.com/jcfaria/fdth-python-fork_2026.1/raw/main/dist/fdth-1.0.0-py3-none-any.whl
Release notes: NEWS.md.
Features
- Frequency distribution tables (FDT) from lists, NumPy arrays, and pandas objects
- Numerical and categorical variables, plus multi-column / grouped tables
- Histograms and frequency polygons (absolute, relative, cumulative)
- Summary measures from grouped data (mean, median, mode, quantiles, variance, …)
- Grouping with multiple keys via
by=(beyond the original R single-key limit)
Requires Python 3.10+. Depends on pandas, numpy, and matplotlib.
Quick start
from fdth import fdt
data = [1, 5, 8, 3, 12, 7, 4, 9]
table = fdt(data)
print(table)
table.plot()
fdt() detects the data type and returns NumericalFDT, CategoricalFDT, or
MultipleFDT as appropriate.
Grouped example
Build FDTs for every column, split by several grouping variables, and plot:
import pandas as pd
from fdth import fdt
df = pd.DataFrame({
"Height": [170, 175, 180, 165, 172, 168, 175, 170, 160, 155],
"Weight": [70, 75, 80, 65, 72, 68, 75, 70, 60, 55],
"Age": [30, 20, 30, 18, 30, 27, 24, 50, 60, 9],
"Sex": ["M", "I", "M", "I", "M", "F", "I", "F", "F", "F"],
"Region": [
"Northeast", "Southeast", "Northeast", "Southeast", "North",
"North", "Southeast", "Northeast", "North", "Southeast",
],
"MaritalStatus": [
"Married", "Single", "Single", "Married", "Single",
"Single", "Married", "Married", "Single", "Married",
],
})
mfdt = fdt(df, by=["Sex", "MaritalStatus", "Region"])
mfdt.plot(numeric_type="fh", categorical_type="fb")
Page 1
Page 2
More notebooks live under examples/python.
Development
git clone https://github.com/jcfaria/fdth-python-fork_2026.1.git
cd fdth-python-fork_2026.1
python -m venv venv
# Linux / macOS: source venv/bin/activate
# Windows CMD: venv\Scripts\activate.bat
# Windows PS: venv\Scripts\Activate.ps1
pip install -e ".[dev]"
| Task | Command |
|---|---|
| Tests | python -m unittest discover -s tests |
| Format | black . |
| Type check | mypy --strict --cache-fine-grained . |
| API docs | pdoc -o doc fdth |
| Build | python -m build |
A short Git tutorial in Portuguese is available in HelpGit.md.
Background
This Python port grew through collective work in the Probability and Statistics course (Computer Science, UESC) across semesters 2025.1, 2025.2, and 2026.1. Earlier ports existed before that; the object-oriented design solidified in 2025. The package aims for full coverage of the original R fdth functionality.
Credits
Original R package — jcfaria/fdth
Initial Python port — yuriccosta/fdth-python
2025.1 — Gabriel Galdino, Luciene Mª Torquato C. Batista, Stella Ribas, Thainá Guimarães, Yohanan Santana
2025.2 — Alex Amaral dos Santos, Isaque Silva Passos Ribeiro, Kaiala de Jesus Santos, Olinoedson Silva Sena
2026.1 — Ariel Mariano Vieira, Eduardo Ferreira Diniz da Silva, Pedro Lucas do Nascimento de Oliveira
Author / Maintainer
Faria, J. C.
Universidade Estadual de Santa Cruz — UESC
Departamento de Ciências Exatas — DCEX
Ilhéus — Bahia — Brazil
- Email: joseclaudio.faria@gmail.com
- GitHub: jcfaria
- R package: GitHub · CRAN
License
This package is free software under the GNU General Public License, version 2 (GPL-2.0).
See LICENSE for the full text.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdth-1.0.0.tar.gz.
File metadata
- Download URL: fdth-1.0.0.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04f5b94921dcd08b178b31b940b09c5744a26c1616e8e028ec836c5b79484eda
|
|
| MD5 |
3a2c7aa7ef04074c5d55cb88b1b1acca
|
|
| BLAKE2b-256 |
47a17f5e6abc7107e38e26618559a3df60b44ff8d419e29ad9677acf68f4df2f
|
File details
Details for the file fdth-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fdth-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ae1618de0138b0a529e6c97561d609310e1833c52d3efe0cc352bc1fd376a07
|
|
| MD5 |
d6799421aa020740b57a8d24ca93a692
|
|
| BLAKE2b-256 |
0f53ab01efb6f1958e80685f856de6c6ade0e8fcc249492b1ee816ad05a3a0cb
|