Coder Social home page Coder Social logo

inequality_coefficients's Introduction

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.

inequality_coefficients's People

Contributors

akronix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.