Trait polars_core::chunked_array::ops::ChunkWindowCustom[][src]

pub trait ChunkWindowCustom<T> {
    fn rolling_custom<F>(
        &self,
        _window_size: usize,
        _weight: Option<&[f64]>,
        _fold_fn: F,
        _init_fold: InitFold
    ) -> Result<Self>
    where
        F: Fn(Option<T>, Option<T>) -> Option<T> + Copy,
        Self: Sized
, { ... } }

Provided methods

fn rolling_custom<F>(
    &self,
    _window_size: usize,
    _weight: Option<&[f64]>,
    _fold_fn: F,
    _init_fold: InitFold
) -> Result<Self> where
    F: Fn(Option<T>, Option<T>) -> Option<T> + Copy,
    Self: Sized
[src]

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.
Loading content...

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 + Copy
[src]

Loading content...