mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
* DSL stats functions [WIP] * refactor * move percentile computation to bifs module; iterate * mode and antimode * percentile iterate * percentile sketching * neaten * unit-test iterate * unify old & new min & max functions * unit-test cases * code-dedupe between mode and antimode * make mode/antimode ties deterministic via first-found-wins rule * online help strings for new stats DSL functions * artifacts from `make dev` * help info on how min/max now recurse into collections * artifacts from `make dev` * typofix
39 lines
818 B
Text
39 lines
818 B
Text
begin {
|
|
@a = [];
|
|
@m = {};
|
|
@field = "i";
|
|
}
|
|
|
|
@a[NR] = $[@field];
|
|
@m[NR] = $[@field];
|
|
|
|
end {
|
|
outputs = {
|
|
|
|
"a_count": count(@a),
|
|
"a_sum": sum(@a),
|
|
"a_sum2": sum2(@a),
|
|
"a_sum3": sum3(@a),
|
|
"a_sum4": sum4(@a),
|
|
"a_mean": mean(@a),
|
|
"a_var": variance(@a),
|
|
"a_stddev": stddev(@a),
|
|
"a_meaneb": meaneb(@a),
|
|
"a_skewness": skewness(@a),
|
|
"a_kurtosis": kurtosis(@a),
|
|
|
|
"m_count": count(@m),
|
|
"m_sum": sum(@m),
|
|
"m_sum2": sum2(@m),
|
|
"m_sum3": sum3(@m),
|
|
"m_sum4": sum4(@m),
|
|
"m_mean": mean(@m),
|
|
"m_var": variance(@m),
|
|
"m_stddev": stddev(@m),
|
|
"m_meaneb": meaneb(@m),
|
|
"m_skewness": skewness(@m),
|
|
"m_kurtosis": kurtosis(@m),
|
|
|
|
};
|
|
emit outputs;
|
|
}
|