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+ - Wheels are provided via PyPI for windows users)
Usage :
>>> import jenkspy
>>> import random
>>> list_of_values = [random.random()*5000 for _ in range(12000)]
>>> breaks = jenkspy.jenks_breaks(list_of_values, nb_class=6)
>>> breaks
(0.1259707312994962, 1270.571003315598, 2527.460251085392, 3763.0374498649376, 4999.87456576267)
>>> import json
>>> with open('tests/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 :
Making a painless installing C extension so it could be used more easily as a dependency in an other package (and so learning how to build wheels using appveyor).
Getting the break values! (and fast!). No fancy functionnality provided, but contributions/forks/etc are welcome.
Other python implementations are currently existing.
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(42.1 kB
view hashes)
Built Distributions
Close
Hashes for jenkspy-0.1.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0a9378c83217b00b7221969c4331572b7cc11ae6c798e68f55aec2a6d98f1c6 |
|
MD5 | cd5cad5a3674960f382a50164812490a |
|
BLAKE2b-256 | 53330cf45ee5016dd876a9a08c379f0d46aca134ad55d29ae1e753271b59c597 |
Close
Hashes for jenkspy-0.1.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 435e8fb9cdc0bd50ecaa484816655f534fb15143eea1fcdad95f902730dc2f1a |
|
MD5 | 4cfc3c0ce89986f48fa121715682fb28 |
|
BLAKE2b-256 | d5e9558853d4b1d1932a5acf18a1958e90dc12c33a9b9a9c9ec6458513ab8b3f |
Close
Hashes for jenkspy-0.1.3-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f41f19e55147af4094a2f968f1e8d1c32c0f7d00b967c019cd3bd10aa75a650 |
|
MD5 | 74e08f5ddfca2e3b2aed71cb76e34464 |
|
BLAKE2b-256 | 8327a5906e0abcd6c5c678f749987aec9db1ee0e65e12236acf2b4e1ea9a8d40 |
Close
Hashes for jenkspy-0.1.3-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58e75dc8c387fcfb4330441a501f330d123b0c7d1701cb5819421522202ed739 |
|
MD5 | 39670eb0313d6714032e1b65a1db91f6 |
|
BLAKE2b-256 | 43a07e952a9f453dd58529883121fa2199b9f38655c3519d58e79fdfa3fc44fa |
Close
Hashes for jenkspy-0.1.3-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01aff86c1f96b5a2f6291b5c870c901421e51dfa1d5a206a6813c4ad32efafa0 |
|
MD5 | 437618b54d862617260403a8229973d0 |
|
BLAKE2b-256 | a2c99e405178eb90b6d31fdc3e1caa907188391927acf0f5c00140ab870b3d61 |
Close
Hashes for jenkspy-0.1.3-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1077e5528791c3964935daca59de733ce61ba31477325e4ed61d1dbce933136 |
|
MD5 | f82fe50fa8f4d741d6412e6efd23e559 |
|
BLAKE2b-256 | 5970d141b75dc686d018f605a830e05d7088f0ef5c9b4862febc0a216fc45566 |