We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7d215ad commit 2cd6853Copy full SHA for 2cd6853
src/functions.rs
@@ -88,6 +88,16 @@ pub fn approx_percentile_cont_with_weight(
88
}
89
90
91
+#[pyfunction]
92
+pub fn avg(expression: PyExpr, distinct: bool) -> PyResult<PyExpr> {
93
+ let expr = functions_aggregate::expr_fn::avg(expression.expr);
94
+ if distinct {
95
+ Ok(expr.distinct().build()?.into())
96
+ } else {
97
+ Ok(expr.into())
98
+ }
99
+}
100
+
101
#[pyfunction]
102
pub fn sum(args: PyExpr) -> PyExpr {
103
functions_aggregate::expr_fn::sum(args.expr).into()
@@ -779,7 +789,6 @@ array_fn!(flatten, array);
779
789
array_fn!(range, start stop step);
780
790
781
791
aggregate_function!(array_agg, ArrayAgg);
782
-aggregate_function!(avg, Avg);
783
792
aggregate_function!(corr, Correlation);
784
793
aggregate_function!(grouping, Grouping);
785
794
aggregate_function!(max, Max);
0 commit comments