gini
Introduced in: v26.8.0 Calculates the Gini coefficient of a column of finite, non-negative numeric values, a measure of inequality in a distribution. The result ranges from0 (perfect equality: all values are the same) to a maximum approaching 1 as n grows (perfect inequality: one value holds everything and the rest are zero). For a finite sample of n values the maximum is (n - 1) / n.
All passed values are collected in their input type and then sorted before a numerically stable final calculation. The coefficient is computed from normalized adjacent pairwise differences and returned as Float64, so it is rounded to Float64 precision. Therefore, the function consumes O(n) memory, where n is the number of values passed. NaN values are skipped, while infinite values are rejected.
Syntax
NaN if there are fewer than 2 values or the sum of the values is 0. Float64
Examples
Equal values
Query
Response
Query
Response