Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
CMCDragonkai / lorenz_curve_gini_coefficient.py
Last active August 20, 2024 16:05
Lorenz Curve and Gini Coefficient #python
import numpy as np
import matplotlib.pyplot as plt
# ensure your arr is sorted from lowest to highest values first!
arr = np.array([1,4,6,9,100])
def gini(arr):
count = arr.size
coefficient = 2 / count
indexes = np.arange(1, count + 1)