proportions property
The proportion of this column made up by each value.
Example:
final species = iris.categoricColumns["species"]!;
for (final MapEntry(:key, :value) in species.proportions.entries) {
print("$key: $value");
}
setosa: 0.3333333333333333
versicolor: 0.3333333333333333
virginica: 0.3333333333333333
Implementation
Map<External, num> get proportions {
final values = this.values;
return {
for (final v in {...values})
v: values.where((x) => x == v).length / length
};
}