dataFrame.columns.stat — giniCoef()
Description
The giniCoef() method of the stat object computes the Gini coefficient for the selected columns.
Signature
dataFrame.columns(...columnNames).stat.giniCoef()Argument
...columnNames( string[] )- The name of the columns from which to compute the Gini coefficient.
Returns
coef(number)- The computed Gini coefficient.
Notes
- The method computes a measure of inequality for the selected values.
- The Gini coefficient ranges from
0to1. - A value of
0indicates perfect equality. - A value of
1indicates maximum inequality. - The coefficient is commonly used to measure the dispersion of income, wealth, or other quantitative variables.
- The method requires numeric values.
Example
// calculate the Gini coefficient of the values of 2 columns of the dataFrame
var coef = dataFrame.columns('age', 'income').stat.giniCoef();
// log the coef
notebook.log(coef);