Trait polars_core::chunked_array::ops::ChunkWindowCustom [−][src]
pub trait ChunkWindowCustom<T> {
fn rolling_custom<F>(
&self,
_window_size: u32,
_weight: Option<&[f64]>,
_fold_fn: F,
_init_fold: InitFold,
_min_periods: u32
) -> Result<Self>
where
F: Fn(Option<T>, Option<T>) -> Option<T> + Copy,
Self: Sized,
{ ... }
}Expand description
Custom rolling window functions
Provided methods
Apply a rolling aggregation over the values in this array.
A window of length window_size will traverse the array. The values that fill this window
will (optionally) be multiplied with the weights given by the weight vector. The resulting
values will be aggregated to their max.
You can pass a custom closure that will be used in the fold operation to aggregate the window.
The closure/fn of type Fn(Option<T>, Option<T>) -> Option<T> takes an accumulator and
a value as argument.
Arguments
window_size- The length of the window.weight- An optional slice with the same length of the window that will be multiplied elementwise with the values in the window.min_periods- Amount of elements in the window that should be filled before computing a result.
Implementors
impl<T> ChunkWindowCustom<<T as ArrowPrimitiveType>::Native> for ChunkedArray<T> where
T: PolarsNumericType,
T::Native: Zero + Bounded + NumCast + Div<Output = T::Native> + Mul<Output = T::Native> + PartialOrd + One + Copy,