Skip to main content

Inequality Coefficients:

This is small library with some implemented coefficients (or indices) intended to measure inequality or concentration of the values in a population.

Implemented coefficients

  • Gini Coefficient:
    • Ordinary
    • Corrected: Using a correction for small datasets based on Deltas, 2003.
  • Ratio top / rest

Installation

This library is hosted on PyPI, so installation is straightforward. The easiest way to install type this at the command line (Linux, Mac, or Windows):

pip install inequality_coefficients

This library also depends on numpy, but pip should take of that for you already.

Basic Usage

For the simplest, typical use cases, this tells you everything you need to know.:

import inequality_coefficients as ineq
data = array([1.7, 3.2 ...]) # data can be list of nums or numpy array
gini_coeff = ineq.gini_coeff(data)
ratio_top_rest = ineq.ratio_top10_rest(data)

Development

To setup the development environment install all the dev dependiencies with pip install -r requirements.txt and install the latest version in your sites-packages with python setup.py develop.

Run tests

I use pytest. Install it with pip install -U pytest and run the test with the development setup with pytest.

Acknowledgements

Firstly, I was based on Felipe Ortega's wikixray code for implementing the gini coefficient, however, my code has changed so much (I have even fixed a bug in his code) and also now I'm using numpy as backend.

Anyway, I want to thank him for open sourcing that project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inequality_coefficients-1.2.0.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file inequality_coefficients-1.2.0.tar.gz.

File metadata

  • Download URL: inequality_coefficients-1.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for inequality_coefficients-1.2.0.tar.gz
Algorithm Hash digest
SHA256 338e75fdded35bae57e7816d775c5617fe7db7f9d26e77f949b6d4096e52d662
MD5 ae7c199673b81f636e3afc3bd28be272
BLAKE2b-256 36af80e37716b0a8e2147b474d7b23cf3b56a840974f608b0c9faf7be44e0a95

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

This release

1.2.0 This release

1 file

1.1.1

1 file

1.1.0

2 files

1.0.1

1 file

1.0.0

2 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