Skip to main content

Ewm

Struct Ewm 

Source
pub struct Ewm<'a> { /* private fields */ }
Expand description

Exponentially weighted moving window aggregation over a Series.

Created by Series::ewm(). Uses the recursive EWM formula: y_t = alpha * x_t + (1 - alpha) * y_{t-1}

Implementations§

Source§

impl Ewm<'_>

Source

pub fn mean(&self) -> Result<Series, FrameError>

EWM mean.

Matches series.ewm(span=...).mean(). Per br-frankenpandas-mm77i: pandas carries forward the last EWM value for missing inputs once at least one observation has been seen (default min_periods=1).

Source

pub fn sum(&self) -> Result<Series, FrameError>

EWM weighted sum.

Matches series.ewm(span=...).sum(). Uses the recursive formula s_t = x_t + (1 - alpha) * s_{t-1} where alpha is the smoothing factor derived from span. Leading missing values stay null until the first observation is seen.

Source

pub fn cov(&self, other: &Series) -> Result<Series, FrameError>

EWM covariance with another Series (sample, ddof=1).

Matches series.ewm(span=...).cov(other). Uses Welford-style online updates with exponential weighting over aligned positions; missing positions on either side emit Null(NaN) without advancing the running estimate. Returns LengthMismatch when inputs differ in length.

Source

pub fn corr(&self, other: &Series) -> Result<Series, FrameError>

EWM Pearson correlation with another Series.

Matches series.ewm(span=...).corr(other). Uses the same exponentially weighted covariance path as cov(other) and normalizes by the two exponentially weighted standard deviations.

Source

pub fn std(&self) -> Result<Series, FrameError>

EWM standard deviation (sample, ddof=1).

Matches series.ewm(span=...).std().

Source

pub fn var(&self) -> Result<Series, FrameError>

EWM variance (sample, ddof=1).

Uses the online formula for exponentially weighted variance. Matches series.ewm(span=...).var().

Source

pub fn agg(&self, funcs: &[&str]) -> Result<DataFrame, FrameError>

Apply one or more aggregation functions and return a DataFrame keyed by function name. Matches series.ewm(span=...).agg(['mean', 'sum']). Per br-frankenpandas-mvynk.

Source

pub fn aggregate(&self, funcs: &[&str]) -> Result<DataFrame, FrameError>

pandas alias for Self::agg. Matches ewm.aggregate([...]).

Source

pub fn online(&self) -> Result<OnlineEwm, FrameError>

Begin an online (streaming) EWM accumulation.

Matches series.ewm(span=...).online() (pandas 1.4+). Returns an OnlineEwm that maintains running mean state across incremental update(value) calls without re-scanning the input each time. Per br-frankenpandas-mvynk.

Source

pub fn exclusions(&self) -> Vec<String>

Frozenset-style label set of columns excluded from this window.

Matches pd.api.indexers.BaseIndexer.exclusions / EWM.exclusions. EWM on a Series has no excluded columns; returns an empty Vec. Per br-frankenpandas-mvynk.

Source

pub fn ndim(&self) -> usize

Number of dimensions of the underlying object. Series-EWM is 1.

Matches pd.ExponentialMovingWindow.ndim. Per br-frankenpandas-mvynk.

Auto Trait Implementations§

§

impl<'a> Freeze for Ewm<'a>

§

impl<'a> RefUnwindSafe for Ewm<'a>

§

impl<'a> Send for Ewm<'a>

§

impl<'a> Sync for Ewm<'a>

§

impl<'a> Unpin for Ewm<'a>

§

impl<'a> UnsafeUnpin for Ewm<'a>

§

impl<'a> UnwindSafe for Ewm<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.