EEvencrest
Product

Product features · Exact uncorrected Gini coefficient

01

Review gini_fraction.py as a defined concentration calculation, keeping interpretation outside the arithmetic.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Exact uncorrected Gini coefficient

● ● ●Evencrest●
A concrete starting point · Exact uncorrected Gini coefficient ×
from fractions import Fraction

def gini_fraction(values):
    if type(values) is not list or not 1 <= len(values) <= 4096 or any(type(x) is not int or not 0 <= x <= 10**9 for x in values):
        raise ValueError("gini.values")
    total, n = sum(values), len(values)
    if total == 0:
        return Fraction(0, 1)
    numerator = sum((2*i-n-1)*value for i, value in enumerate(sorted(values), 1))
    return Fraction(numerator, n*total)
✳Exact uncorrected Gini coefficient
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗