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<'_>
impl Ewm<'_>
Sourcepub fn mean(&self) -> Result<Series, FrameError>
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).
Sourcepub fn sum(&self) -> Result<Series, FrameError>
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.
Sourcepub fn cov(&self, other: &Series) -> Result<Series, FrameError>
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.
Sourcepub fn corr(&self, other: &Series) -> Result<Series, FrameError>
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.
Sourcepub fn std(&self) -> Result<Series, FrameError>
pub fn std(&self) -> Result<Series, FrameError>
EWM standard deviation (sample, ddof=1).
Matches series.ewm(span=...).std().
Sourcepub fn var(&self) -> Result<Series, FrameError>
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().
Sourcepub fn agg(&self, funcs: &[&str]) -> Result<DataFrame, FrameError>
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.
Sourcepub fn aggregate(&self, funcs: &[&str]) -> Result<DataFrame, FrameError>
pub fn aggregate(&self, funcs: &[&str]) -> Result<DataFrame, FrameError>
pandas alias for Self::agg. Matches ewm.aggregate([...]).
Sourcepub fn online(&self) -> Result<OnlineEwm, FrameError>
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.
Sourcepub fn exclusions(&self) -> Vec<String>
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.