Skip to main content

Coefficients to measure inequality.

Project description

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)

Acknowledgements

Firstly, I was based on Felipe Ortega's wikixray code for implementing the gini coefficient, however, my code has changed so much and I'm using numpy as backend.

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

Project details


Download files

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

Files for inequality-coefficients, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size inequality_coefficients-1.1.0.linux-x86_64.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View hashes
Filename, size inequality_coefficients-1.1.0-py3-none-any.whl (5.2 kB) File type Wheel Python version 3.6 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page