File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,16 @@ pub fn approx_percentile_cont_with_weight(
8888 }
8989}
9090
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+
91101#[ pyfunction]
92102pub fn sum ( args : PyExpr ) -> PyExpr {
93103 functions_aggregate:: expr_fn:: sum ( args. expr ) . into ( )
@@ -779,7 +789,6 @@ array_fn!(flatten, array);
779789array_fn ! ( range, start stop step) ;
780790
781791aggregate_function ! ( array_agg, ArrayAgg ) ;
782- aggregate_function ! ( avg, Avg ) ;
783792aggregate_function ! ( corr, Correlation ) ;
784793aggregate_function ! ( grouping, Grouping ) ;
785794aggregate_function ! ( max, Max ) ;
You can’t perform that action at this time.
0 commit comments