diff --git a/polars_xdt/functions.py b/polars_xdt/functions.py index 7cc9dd7..9a5df09 100644 --- a/polars_xdt/functions.py +++ b/polars_xdt/functions.py @@ -858,7 +858,7 @@ def ewma_by_time( y_0 &= x_0 - \alpha_i &= (\alpha_{i-1} + 1) * \exp(-\lambda(t_i - t_{i-1})) + \alpha_i &= (\alpha_{i-1} + 1) \exp(-\lambda(t_i - t_{i-1})) y_i &= (x_i + \alpha_i y_{i-1}) / (1. + \alpha_i); diff --git a/src/ewma_by_time.rs b/src/ewma_by_time.rs index 3267ba2..f9abf6f 100644 --- a/src/ewma_by_time.rs +++ b/src/ewma_by_time.rs @@ -28,7 +28,7 @@ pub(crate) fn impl_ewma_by_time_float( .iter() .zip(times.iter()) .skip(1) - .map(|(value, time)| { + .for_each(|(value, time)| { match (time, value) { (Some(time), Some(value)) => { let delta_time = time - prev_time; @@ -50,8 +50,7 @@ pub(crate) fn impl_ewma_by_time_float( } _ => out.push(None), } - }) - .collect::>(); + }); let arr = PrimitiveArray::::from(out); Float64Chunked::from(arr) }