jenkspy
Compute Natural Breaks (Fisher-Jenks algorithm)
What it is and what it does
Jenkspy implements the Fisher-Jenks algorithm, a deterministic optimization method that finds the best way to partition numerical data into a specified number of classes by minimizing variance within each class. It accepts lists, tuples, arrays, or numpy arrays of integers or floats and returns the break points that define class boundaries. The package provides two interfaces: a simple `jenks_breaks()` function for direct break computation, and a scikit-learn-style `JenksNaturalBreaks` class for fitting, prediction, and grouping workflows.
The library is built as a C extension and ships with pre-compiled wheels for major platforms and Python versions, eliminating compilation for most users. It depends only on numpy and is marked Production/Stable with MIT licensing, making it suitable for integration into data analysis and geospatial classification pipelines.
Use it for:
- Classify geographic or demographic data into natural groups for choropleth mapping or statistical analysis.
- Discretize continuous variables into optimal bins for machine learning feature engineering.
- Identify natural thresholds in sensor or time-series data for alerting or segmentation.
- Group numerical measurements into categories with minimal within-group variation for reporting.
- Partition income, age, or other population data into statistically meaningful brackets.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes optimal class boundaries for numerical data using the Fisher-Jenks algorithm, partitioning a list or array into natural groups with minimal within-class variance.
Yes. Jenkspy is a stable, production-ready library with no known vulnerabilities, permissive MIT licensing, and solid adoption. Install friction is moderate due to C compilation, but wheels eliminate this for most users. Use it if you need deterministic, optimal class boundaries for numerical data.
Install
jenkspy on PyPI
pip
pip install jenkspyuv
uv add jenkspypoetry
poetry add jenkspyInstalling jenkspy
Before you install
Medium install friction due to C extension compilation, but wheels are provided for Windows, macOS, and Linux across multiple Python versions. Repository is aging but stable and actively maintained with recent commit activity.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.
Quickstart
import jenkspy
import numpy as np
data = [0.0, 1.5, 2.3, 5.1, 6.8, 9.2]
breaks = jenkspy.jenks_breaks(data, n_classes=3)
print(breaks) # [0.0, 2.3, 6.8, 9.2]
Requires numpy as a runtime dependency; C compiler needed only when building from source.
Verify before relying
- Performance characteristics (speed relative to other implementations) not quantified in fact sheet.
- Exact support status for Python 3.7–3.9—wheels shown for 3.10+ only, though classifiers list earlier versions.
- Whether the package remains actively developed or is in maintenance-only mode given 802-day release gap.
Package facts
| License | MIT License Copyright (c) 2016-2022 Matthieu Viry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | aging — 802 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 207,474/month — #9,550 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jenkspy-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl; jenkspy-0.4.1-cp310-cp310-macosx_11_0_arm64.whl; jenkspy-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; jenkspy-0.4.1-cp310-cp310-win_amd64.whl; jenkspy-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl; jenkspy-0.4.1-cp311-cp311-macosx_11_0_arm64.whl; jenkspy-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; jenkspy-0.4.1-cp311-cp311-win_amd64.whl; jenkspy-0.4.1-cp312-cp312-macosx_10_9_x86_64.whl; jenkspy-0.4.1-cp312-cp312-macosx_11_0_arm64.whl; jenkspy-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; jenkspy-0.4.1-cp312-cp312-win_amd64.whl; jenkspy-0.4.1-cp313-cp313-macosx_10_13_x86_64.whl; jenkspy-0.4.1-cp313-cp313-macosx_11_0_arm64.whl; jenkspy-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; jenkspy-0.4.1-cp313-cp313-win_amd64.whl; jenkspy-0.4.1-cp314-cp314-macosx_10_15_x86_64.whl; jenkspy-0.4.1-cp314-cp314-macosx_11_0_arm64.whl; jenkspy-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; jenkspy-0.4.1-cp314-cp314t-macosx_10_15_x86_64.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
kmodesImplements k-modes and k-prototypes clustering…
permissive · top 15,000 on PyPI
optbinningOptBinning discretizes numeric variables into…
permissive · top 15,000 on PyPI
k-means-constrainedK-means clustering with enforced minimum and…
permissive · top 15,000 on PyPI
lapSolves the linear assignment problem using the…
permissive · top 5,000 on PyPI
BottleneckBottleneck provides fast NumPy array functions…
permissive · top 5,000 on PyPI
munkresImplements the Munkres algorithm (Hungarian…
permissive · top 15,000 on PyPI
multiscale-spatial-imageGenerates multiscale image pyramids organized…
permissive · top 15,000 on PyPI
dwave-samplersProvides a collection of classical and hybrid…
permissive · top 15,000 on PyPI
nclsNCLS provides a fast interval overlap query…
permissive · top 15,000 on PyPI