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
- 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
Many thanks to Felipe Ortega to open source his implementation of the Gini coefficient, available here: https://github.com/ryanwitt/wikixray/blob/master/graphics.py.
My code is based on that implementation, although I have made some changes and added a correction for small datasets based on Deltas, 2003.
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
Hashes for inequality_coefficients-1.0.1.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dccd5c6ef119cb018a65762f0ed3ce472ec67692afad710d7f59dbf10159918 |
|
MD5 | 95054f2740a5b11d0b522a7556eb422f |
|
BLAKE2b-256 | 943a5f24dd59a052e267bb6ee86b09877615f37820026054379f43ce85753c81 |