Economic Inequality Metrics in Python for My Thesis
- Supports Python 2 and 3
- Requires Numpy and Matplotlib
- Installation
- Examples
$ git clone https://github.com/jpcarroll/Econopy.git
$ cd Econopy
import econopy as ep
import numpy as np
j = np.array([241,104,93,346,228,487,173,222,9,188])
k = np.array([299,427,317,311,269,263,22,342,382,159])
l = np.array([-330,0,322,273,156,25,52,186,308,315])
To calculate the Gini Coefficient:
print (ep.gini(j))
$ 0.332711621234
To calculate the Hill's alpha parameter:
print (ep.hill(k))
$ 1.42639302646
To graph a Cumulative distribution function (CDF):
ep.cdf(j)
The Gini coefficient can also accept zeros and negative numbers:
print (ep.gini(l))
$ 0.77895944912