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(
88
88
}
89
89
}
90
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
+
91
101
#[ pyfunction]
92
102
pub fn sum ( args : PyExpr ) -> PyExpr {
93
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 ) ;
You can’t perform that action at this time.
0 commit comments