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.0FrankenPandas 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<'_, '_>
impl SeriesGroupByRolling<'_, '_>
Sourcepub fn sum(&self) -> Result<Series, FrameError>
pub fn sum(&self) -> Result<Series, FrameError>
Grouped rolling sum.
Sourcepub fn mean(&self) -> Result<Series, FrameError>
pub fn mean(&self) -> Result<Series, FrameError>
Grouped rolling mean.
Sourcepub fn min(&self) -> Result<Series, FrameError>
pub fn min(&self) -> Result<Series, FrameError>
Grouped rolling minimum.
Sourcepub fn max(&self) -> Result<Series, FrameError>
pub fn max(&self) -> Result<Series, FrameError>
Grouped rolling maximum.
Sourcepub fn std(&self) -> Result<Series, FrameError>
pub fn std(&self) -> Result<Series, FrameError>
Grouped rolling sample standard deviation.
Sourcepub fn count(&self) -> Result<Series, FrameError>
pub fn count(&self) -> Result<Series, FrameError>
Grouped rolling count of non-null values.
Sourcepub fn var(&self) -> Result<Series, FrameError>
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> !UnwindSafe for SeriesGroupByRolling<'grouped, 'data>
impl<'grouped, 'data> Freeze for SeriesGroupByRolling<'grouped, 'data>
impl<'grouped, 'data> Send for SeriesGroupByRolling<'grouped, 'data>
impl<'grouped, 'data> Sync 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more