pub struct GroupedTidyView { /* private fields */ }Expand description
A grouped view produced by TidyView::group_by(...).
Holds the original TidyView (unchanged) plus a GroupIndex over its
visible rows. No column data is copied.
After grouping, ungroup() restores the plain TidyView.
summarise() collapses each group into one summary row.
A TidyView that has been grouped by one or more columns.
Created by TidyView::group_by. Holds the original view plus a
GroupIndex that maps rows to groups. Call summarise
to aggregate or ungroup to return to a flat view.
Implementations§
Source§impl GroupedTidyView
impl GroupedTidyView
Sourcepub fn group_index(&self) -> &GroupIndex
pub fn group_index(&self) -> &GroupIndex
Access the group index (for testing/inspection).
Sourcepub fn summarise(
&self,
assignments: &[(&str, TidyAgg)],
) -> Result<TidyFrame, TidyError>
pub fn summarise( &self, assignments: &[(&str, TidyAgg)], ) -> Result<TidyFrame, TidyError>
Collapse each group to one summary row using named aggregators.
assignments is an ordered list of (output_name, aggregator).
Output rows are in first-occurrence group order (deterministic).
The result is a TidyFrame containing:
• One column per group key (in key order)
• One column per aggregator (in assignment order)
Aggregator semantics (empty group): • count → 0 • sum → 0.0 • mean → f64::NAN • min → f64::NAN • max → f64::NAN • first / last → TidyError::EmptyGroup
Source§impl GroupedTidyView
impl GroupedTidyView
Sourcepub fn mutate_across(
&self,
specs: &[AcrossSpec],
) -> Result<TidyFrame, TidyError>
pub fn mutate_across( &self, specs: &[AcrossSpec], ) -> Result<TidyFrame, TidyError>
Apply across transformations then mutate each group in-place.
For each group, applies each AcrossSpec transform to the specified columns,
producing output named {col}_{fn} (or per-template).
Returns a materialized TidyFrame with all groups combined.
Sourcepub fn summarise_across(
&self,
specs: &[AcrossSpec],
) -> Result<TidyFrame, TidyError>
pub fn summarise_across( &self, specs: &[AcrossSpec], ) -> Result<TidyFrame, TidyError>
Summarise with across transforms: apply each transform to each column, collecting one aggregate value per group.
The specs use AcrossSpec where the transform function must return a
single-element column (scalar reduction). If it returns more than one row,
TidyError::LengthMismatch is returned.
Trait Implementations§
Source§impl Clone for GroupedTidyView
impl Clone for GroupedTidyView
Source§fn clone(&self) -> GroupedTidyView
fn clone(&self) -> GroupedTidyView
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GroupedTidyView
impl RefUnwindSafe for GroupedTidyView
impl !Send for GroupedTidyView
impl !Sync for GroupedTidyView
impl Unpin for GroupedTidyView
impl UnsafeUnpin for GroupedTidyView
impl UnwindSafe for GroupedTidyView
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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