Skip to main content

Compute Natural Breaks (Jenks algorythm)

Project description

Compute “natural” break values (Jenks algorythm) on list/tuple/numpy.ndarray of integers/floats.

(Intented compatibility: CPython 2.7+ and 3.3+)

Build Status travis Build status appveyor

Usage :

>>> import random
>>> list_of_values = [random.random()*5000 for _ in range(12000)]

>>> import jenkspy
>>> breaks = jenkspy.jenks_breaks(list_of_values, nb_class=6)

>>> import json
>>> with open('test.json', 'r') as f:
...     data = json.loads(f.read())
...
>>> jenkspy.jenks_breaks(data, nb_class=5)
(0.0028109620325267315, 2.0935479691252112, 4.205495140049607, 6.178148351609707, 8.09175917180255, 9.997982932254672)

Installation :

pip install jenkspy
git clone http://github.com/mthh/jenkspy
cd jenkspy/
python setup.py install

Requirements (only for building from source):

  • C compiler

  • Python C headers

Motivation :

  • Could be used as an eventual dependency in other package (using appveyor and travis to build wheels for easier installation via pip).

  • Getting the break values! (and fast!)

  • Other python implementations are currently existing.

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

jenkspy-0.1.0.tar.gz (20.0 kB view details)

Uploaded Source

File details

Details for the file jenkspy-0.1.0.tar.gz.

File metadata

  • Download URL: jenkspy-0.1.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jenkspy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ef2035218d4cb844d00e29d061bb0213e3c55bf377f4d311e3e208f59dcf57d
MD5 82d82a4f4c5e8dab5c63420ed63c5b95
BLAKE2b-256 824661b532d7b35b565b78d669378426a346a9976b02de517a778846522289e9

See more details on using hashes here.

Supported by

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