Skip to main content

SeriesGroupByRolling

Struct SeriesGroupByRolling 

Source
pub struct SeriesGroupByRolling<'grouped, 'data> { /* private fields */ }
Expand description

Grouped rolling window over a SeriesGroupBy.

Created by SeriesGroupBy::rolling(). Applies existing Series rolling operations within each group independently, then SCATTERS the results back to the original flat Series index.

⚠️ THAT LAST STEP IS A KNOWN DIVERGENCE, NOT THE CONTRACT (br-frankenpandas-nyjxf). pandas REORDERS BY GROUP and returns a two-level index of (group key, original label). MEASURED, live pandas 2.2.3, on values [1..6] keyed [‘b’,‘a’,‘b’,‘a’,‘b’,‘a’]:

s.groupby(k).rolling(2).sum()
  a  1   NaN     <- every 'a' row first, in original order within the group
     3   6.0
     5  10.0
  b  0   NaN
     2   4.0
     4   8.0

FrankenPandas returns those six values at rows 0..5 instead. The DataFrameGroupBy twin (GroupByRolling::apply_grouped_rolling) was already changed to emit in group-visit order; this one was not, so the two grouped rolling surfaces currently disagree with each other as well as with pandas.

Porting the twin here is mechanical but NOT free: this impl has a parallel arm that chunks by key range, so the per-group output base has to be derived from a prefix sum of group sizes rather than from a running offset, and the twin’s own comment records its row-count change as UNVERIFIED. It wants a compiler, not another unbuilt edit.

Implementations§

Source§

impl SeriesGroupByRolling<'_, '_>

Source

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

Grouped rolling sum.

Source

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

Grouped rolling mean.

Source

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

Grouped rolling minimum.

Source

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

Grouped rolling maximum.

Source

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

Grouped rolling sample standard deviation.

Source

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

Grouped rolling count of non-null values.

Source

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

Grouped rolling sample variance.

Auto Trait Implementations§

§

impl<'grouped, 'data> !RefUnwindSafe for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> !Send for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> !Sync for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> !UnwindSafe for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> Freeze for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> Unpin for SeriesGroupByRolling<'grouped, 'data>

§

impl<'grouped, 'data> UnsafeUnpin for SeriesGroupByRolling<'grouped, 'data>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.