pub struct SeriesGroupBy<'a> { /* private fields */ }Expand description
GroupBy for Series, grouping by values of another Series.
Created by Series::groupby(by). Supports standard aggregation
methods that return a new Series indexed by group keys.
Implementations§
Source§impl SeriesGroupBy<'_>
impl SeriesGroupBy<'_>
Sourcepub fn keys(&self) -> Vec<IndexLabel>
pub fn keys(&self) -> Vec<IndexLabel>
Group labels in first-seen order.
Sourcepub fn indices(&self) -> HashMap<IndexLabel, Vec<usize>>
pub fn indices(&self) -> HashMap<IndexLabel, Vec<usize>>
Mapping from group labels to source row positions.
Sourcepub fn groups(&self) -> HashMap<IndexLabel, Vec<usize>>
pub fn groups(&self) -> HashMap<IndexLabel, Vec<usize>>
Alias for indices, matching pandas’ groups property shape.
Sourcepub fn level(&self) -> Option<String>
pub fn level(&self) -> Option<String>
Grouping level descriptor.
Series::groupby(by) currently groups by a supplied Series rather than
by an index level, so this mirrors pandas’ None level state.
Sourcepub fn plot(&self) -> Result<PlotSpec, FrameError>
pub fn plot(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped plotting request.
Sourcepub fn line(&self) -> Result<PlotSpec, FrameError>
pub fn line(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped line plot request.
Sourcepub fn line_to_svg(&self) -> Result<String, FrameError>
pub fn line_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series line plot directly to deterministic SVG string.
Sourcepub fn line_to_html(&self) -> Result<String, FrameError>
pub fn line_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series line plot directly to HTML figure snippet.
Sourcepub fn line_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn line_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series line plot directly to disk.
Sourcepub fn bar(&self) -> Result<PlotSpec, FrameError>
pub fn bar(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped bar plot request.
Sourcepub fn bar_to_svg(&self) -> Result<String, FrameError>
pub fn bar_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series bar plot directly to deterministic SVG string.
Sourcepub fn bar_to_html(&self) -> Result<String, FrameError>
pub fn bar_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series bar plot directly to HTML figure snippet.
Sourcepub fn bar_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn bar_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series bar plot directly to disk.
Sourcepub fn barh(&self) -> Result<PlotSpec, FrameError>
pub fn barh(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped horizontal bar plot request.
Sourcepub fn barh_to_svg(&self) -> Result<String, FrameError>
pub fn barh_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series horizontal bar plot directly to deterministic SVG string.
Sourcepub fn barh_to_html(&self) -> Result<String, FrameError>
pub fn barh_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series horizontal bar plot directly to HTML figure snippet.
Sourcepub fn barh_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn barh_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series horizontal bar plot directly to disk.
Sourcepub fn area(&self) -> Result<PlotSpec, FrameError>
pub fn area(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped area plot request.
Sourcepub fn area_to_svg(&self) -> Result<String, FrameError>
pub fn area_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series area plot directly to deterministic SVG string.
Sourcepub fn area_to_html(&self) -> Result<String, FrameError>
pub fn area_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series area plot directly to HTML figure snippet.
Sourcepub fn area_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn area_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series area plot directly to disk.
Sourcepub fn scatter(&self) -> Result<PlotSpec, FrameError>
pub fn scatter(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped scatter plot request.
Sourcepub fn scatter_to_svg(&self) -> Result<String, FrameError>
pub fn scatter_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series scatter plot directly to deterministic SVG string.
Sourcepub fn scatter_to_html(&self) -> Result<String, FrameError>
pub fn scatter_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series scatter plot directly to HTML figure snippet.
Sourcepub fn scatter_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn scatter_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series scatter plot directly to disk.
Sourcepub fn pie(&self) -> Result<PlotSpec, FrameError>
pub fn pie(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped pie plot request.
Sourcepub fn pie_to_svg(&self) -> Result<String, FrameError>
pub fn pie_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series pie plot directly to deterministic SVG string.
Sourcepub fn pie_to_html(&self) -> Result<String, FrameError>
pub fn pie_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series pie plot directly to HTML figure snippet.
Sourcepub fn pie_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn pie_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series pie plot directly to disk.
Sourcepub fn kde(&self) -> Result<PlotSpec, FrameError>
pub fn kde(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped kernel density estimation plot request.
Sourcepub fn kde_to_svg(&self) -> Result<String, FrameError>
pub fn kde_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series KDE plot directly to deterministic SVG string.
Sourcepub fn kde_to_html(&self) -> Result<String, FrameError>
pub fn kde_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series KDE plot directly to HTML figure snippet.
Sourcepub fn kde_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn kde_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series KDE plot directly to disk.
Sourcepub fn density(&self) -> Result<PlotSpec, FrameError>
pub fn density(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped density plot request (alias for SeriesGroupBy::kde).
Sourcepub fn density_to_svg(&self) -> Result<String, FrameError>
pub fn density_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series density plot directly to deterministic SVG string.
Sourcepub fn density_to_html(&self) -> Result<String, FrameError>
pub fn density_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series density plot directly to HTML figure snippet.
Sourcepub fn density_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn density_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series density plot directly to disk.
Sourcepub fn hexbin(&self) -> Result<PlotSpec, FrameError>
pub fn hexbin(&self) -> Result<PlotSpec, FrameError>
Return a backend-neutral pandas-style grouped hexbin plot request.
Sourcepub fn hexbin_to_svg(&self) -> Result<String, FrameError>
pub fn hexbin_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series hexbin plot directly to deterministic SVG string.
Sourcepub fn hexbin_to_html(&self) -> Result<String, FrameError>
pub fn hexbin_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series hexbin plot directly to HTML figure snippet.
Sourcepub fn hexbin_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn hexbin_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series hexbin plot directly to disk.
Sourcepub fn plot_with_kind(&self, kind: PlotKind) -> Result<PlotSpec, FrameError>
pub fn plot_with_kind(&self, kind: PlotKind) -> Result<PlotSpec, FrameError>
Return a backend-neutral grouped plot request for the specified plot kind.
Sourcepub fn hist(&self) -> Result<HistogramSpec, FrameError>
pub fn hist(&self) -> Result<HistogramSpec, FrameError>
Return a backend-neutral pandas-style grouped histogram request.
Sourcepub fn boxplot(&self) -> Result<BoxPlotSpec, FrameError>
pub fn boxplot(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style grouped boxplot request.
Sourcepub fn box_plot(&self) -> Result<BoxPlotSpec, FrameError>
pub fn box_plot(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style grouped boxplot request (alias for SeriesGroupBy::boxplot).
Sourcepub fn box(&self) -> Result<BoxPlotSpec, FrameError>
pub fn box(&self) -> Result<BoxPlotSpec, FrameError>
Return a backend-neutral pandas-style grouped boxplot request (alias for SeriesGroupBy::boxplot).
Sourcepub fn plot_to_svg(&self) -> Result<String, FrameError>
pub fn plot_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series plot directly to deterministic SVG string.
Sourcepub fn plot_to_html(&self) -> Result<String, FrameError>
pub fn plot_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series plot directly to HTML figure snippet.
Sourcepub fn plot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn plot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series plot directly to disk.
Sourcepub fn hist_to_svg(&self) -> Result<String, FrameError>
pub fn hist_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series histogram directly to deterministic SVG string.
Sourcepub fn hist_to_html(&self) -> Result<String, FrameError>
pub fn hist_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series histogram directly to HTML figure snippet.
Sourcepub fn hist_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn hist_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series histogram directly to disk.
Sourcepub fn hist_with_bins(&self, bins: usize) -> Result<HistogramSpec, FrameError>
pub fn hist_with_bins(&self, bins: usize) -> Result<HistogramSpec, FrameError>
Return a backend-neutral grouped histogram request with a custom number of bins.
Sourcepub fn hist_with_bins_to_svg(&self, bins: usize) -> Result<String, FrameError>
pub fn hist_with_bins_to_svg(&self, bins: usize) -> Result<String, FrameError>
Convenience helper: render grouped series histogram with custom bins directly to deterministic SVG string.
Sourcepub fn hist_with_bins_to_html(&self, bins: usize) -> Result<String, FrameError>
pub fn hist_with_bins_to_html(&self, bins: usize) -> Result<String, FrameError>
Convenience helper: render grouped series histogram with custom bins directly to HTML figure snippet.
Sourcepub fn hist_with_bins_to_file<P: AsRef<Path>>(
&self,
bins: usize,
path: P,
) -> Result<(), FrameError>
pub fn hist_with_bins_to_file<P: AsRef<Path>>( &self, bins: usize, path: P, ) -> Result<(), FrameError>
Convenience helper: save rendered grouped series histogram with custom bins directly to disk.
Sourcepub fn boxplot_to_svg(&self) -> Result<String, FrameError>
pub fn boxplot_to_svg(&self) -> Result<String, FrameError>
Convenience helper: render grouped series boxplot directly to deterministic SVG string.
Sourcepub fn boxplot_to_html(&self) -> Result<String, FrameError>
pub fn boxplot_to_html(&self) -> Result<String, FrameError>
Convenience helper: render grouped series boxplot directly to HTML figure snippet.
Sourcepub fn boxplot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
pub fn boxplot_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), FrameError>
Convenience helper: save rendered grouped series boxplot directly to disk.
Sourcepub fn sum(&self) -> Result<Series, FrameError>
pub fn sum(&self) -> Result<Series, FrameError>
Sum of each group.
Sourcepub fn mean(&self) -> Result<Series, FrameError>
pub fn mean(&self) -> Result<Series, FrameError>
Mean of each group.
Sourcepub fn count(&self) -> Result<Series, FrameError>
pub fn count(&self) -> Result<Series, FrameError>
Count of non-null values in each group.
pub fn min(&self) -> Result<Series, FrameError>
Sourcepub fn max(&self) -> Result<Series, FrameError>
pub fn max(&self) -> Result<Series, FrameError>
Maximum of each group.
Sourcepub fn bool_reduce_with_skipna(
&self,
all: bool,
skipna: bool,
) -> Result<Series, FrameError>
pub fn bool_reduce_with_skipna( &self, all: bool, skipna: bool, ) -> Result<Series, FrameError>
pandas’ any(skipna=...) / all(skipna=...): with skipna=false a
missing value is read, as numpy’s bool of NaN, truthy - any of a
group holding one is True, and all is unchanged, a skipped value
never having made it False (br-frankenpandas-n57tz: the keyword was
unexpected). pandas’ nullable dtypes answer <NA> instead (Kleene
logic); callers refuse those.
Sourcepub fn any(&self) -> Result<Series, FrameError>
pub fn any(&self) -> Result<Series, FrameError>
Whether any non-missing value is truthy in each group.
Sourcepub fn all(&self) -> Result<Series, FrameError>
pub fn all(&self) -> Result<Series, FrameError>
Whether all non-missing values are truthy in each group.
Sourcepub fn nunique_with_dropna(&self, dropna: bool) -> Result<Series, FrameError>
pub fn nunique_with_dropna(&self, dropna: bool) -> Result<Series, FrameError>
pandas’ nunique(dropna=...): with dropna=false a group’s missing
values count as one more distinct value (br-frankenpandas-n57tz: the
keyword was unexpected).
pub fn nunique(&self) -> Result<Series, FrameError>
Sourcepub fn unique(&self) -> Result<Series, FrameError>
pub fn unique(&self) -> Result<Series, FrameError>
Unique values in each group, preserving first-seen group and value order.
Sourcepub fn ohlc(&self) -> Result<DataFrame, FrameError>
pub fn ohlc(&self) -> Result<DataFrame, FrameError>
Open-high-low-close per group.
Sourcepub fn quantile(&self, q: f64) -> Result<Series, FrameError>
pub fn quantile(&self, q: f64) -> Result<Series, FrameError>
Quantile of each group using linear interpolation.
Sourcepub fn sem(&self) -> Result<Series, FrameError>
pub fn sem(&self) -> Result<Series, FrameError>
Standard error of the mean for each group.
Sourcepub fn skew_with_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn skew_with_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pandas’ skew(skipna=...): with skipna=false a group holding a
missing value is NaN (br-frankenpandas-n57tz: the keyword was
unexpected).
Sourcepub fn skew(&self) -> Result<Series, FrameError>
pub fn skew(&self) -> Result<Series, FrameError>
Skewness of each group.
Sourcepub fn kurtosis(&self) -> Result<Series, FrameError>
pub fn kurtosis(&self) -> Result<Series, FrameError>
Excess kurtosis (Fisher’s definition, bias=False) of each group.
Matches pd.Series.groupby(...).kurtosis(). Mirrors fp_types::nankurt
which requires at least 4 non-missing values per group; returns
Null(NaN) otherwise and when the sample standard deviation is zero.
Sourcepub fn kurt(&self) -> Result<Series, FrameError>
pub fn kurt(&self) -> Result<Series, FrameError>
Alias for kurtosis() — pandas exposes both .kurt() and
.kurtosis() on Series.groupby aggregations, and parity with that
surface requires both spellings.
Sourcepub fn var_ddof(&self, ddof: usize) -> Result<Series, FrameError>
pub fn var_ddof(&self, ddof: usize) -> Result<Series, FrameError>
Variance of each group with pandas’ ddof; var_ddof(1) is
var.
Sourcepub fn std_ddof(&self, ddof: usize) -> Result<Series, FrameError>
pub fn std_ddof(&self, ddof: usize) -> Result<Series, FrameError>
Standard deviation of each group with pandas’ ddof; std_ddof(1) is
std.
Sourcepub fn sem_ddof(&self, ddof: usize) -> Result<Series, FrameError>
pub fn sem_ddof(&self, ddof: usize) -> Result<Series, FrameError>
Standard error of the mean of each group with pandas’ ddof;
sem_ddof(1) is sem.
Sourcepub fn first_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn first_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pandas’ first(skipna=): with skipna = false each group’s value at
its first row, missing or not; first_skipna(true) is
first.
Sourcepub fn last_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pub fn last_skipna(&self, skipna: bool) -> Result<Series, FrameError>
pandas’ last(skipna=): with skipna = false each group’s value at
its last row, missing or not; last_skipna(true) is last.
Sourcepub fn with_min_count(
&self,
reduced: Series,
min_count: usize,
mask_text: bool,
) -> Result<Series, FrameError>
pub fn with_min_count( &self, reduced: Series, min_count: usize, mask_text: bool, ) -> Result<Series, FrameError>
pandas’ min_count on a sum/prod/min/max/first/last already reduced
into reduced (see DataFrameGroupBy::with_min_count).
pub fn idxmin(&self) -> Result<Series, FrameError>
Sourcepub fn idxmax(&self) -> Result<Series, FrameError>
pub fn idxmax(&self) -> Result<Series, FrameError>
Original index label of the maximum value in each group.
Sourcepub fn is_monotonic_increasing(&self) -> Result<Series, FrameError>
pub fn is_monotonic_increasing(&self) -> Result<Series, FrameError>
Per-group monotonic-increasing predicate.
Sourcepub fn is_monotonic_decreasing(&self) -> Result<Series, FrameError>
pub fn is_monotonic_decreasing(&self) -> Result<Series, FrameError>
Per-group monotonic-decreasing predicate.
Sourcepub fn rank(
&self,
method: &str,
ascending: bool,
na_option: &str,
) -> Result<Series, FrameError>
pub fn rank( &self, method: &str, ascending: bool, na_option: &str, ) -> Result<Series, FrameError>
Rank values within each group.
Matches series.groupby(by).rank().
method: “average” (default), “min”, “max”, “first”, “dense”
ascending: rank direction (default true = smallest gets rank 1)
na_option: “keep” (NaN stays NaN), “top” (NaN gets lowest ranks), “bottom” (NaN gets highest ranks)
Sourcepub fn rank_with_pct(
&self,
method: &str,
ascending: bool,
na_option: &str,
pct: bool,
) -> Result<Series, FrameError>
pub fn rank_with_pct( &self, method: &str, ascending: bool, na_option: &str, pct: bool, ) -> Result<Series, FrameError>
Rank values within each group and optionally scale them to percentile ranks.
Sourcepub fn std(&self) -> Result<Series, FrameError>
pub fn std(&self) -> Result<Series, FrameError>
Standard deviation of each group (ddof=1).
Sourcepub fn var(&self) -> Result<Series, FrameError>
pub fn var(&self) -> Result<Series, FrameError>
Variance of each group (ddof=1).
Sourcepub fn median(&self) -> Result<Series, FrameError>
pub fn median(&self) -> Result<Series, FrameError>
Median of each group.
Sourcepub fn prod(&self) -> Result<Series, FrameError>
pub fn prod(&self) -> Result<Series, FrameError>
Product of each group.
Sourcepub fn cumcount(&self) -> Result<Series, FrameError>
pub fn cumcount(&self) -> Result<Series, FrameError>
Assign within-group cumulative count (0-based).
Sourcepub fn cumcount_with_ascending(
&self,
ascending: bool,
) -> Result<Series, FrameError>
pub fn cumcount_with_ascending( &self, ascending: bool, ) -> Result<Series, FrameError>
Assign within-group cumulative count (0-based) with explicit direction.
Sourcepub fn ngroup(&self) -> Result<Series, FrameError>
pub fn ngroup(&self) -> Result<Series, FrameError>
Assign ordinal group number to each source row.
Sourcepub fn ngroup_with_ascending(
&self,
ascending: bool,
) -> Result<Series, FrameError>
pub fn ngroup_with_ascending( &self, ascending: bool, ) -> Result<Series, FrameError>
Assign ordinal group number with explicit direction.
Sourcepub fn cumsum(&self) -> Result<Series, FrameError>
pub fn cumsum(&self) -> Result<Series, FrameError>
GroupBy cumulative sum.
Sourcepub fn cumprod(&self) -> Result<Series, FrameError>
pub fn cumprod(&self) -> Result<Series, FrameError>
GroupBy cumulative product.
Sourcepub fn cummin(&self) -> Result<Series, FrameError>
pub fn cummin(&self) -> Result<Series, FrameError>
GroupBy cumulative minimum.
Sourcepub fn cummax(&self) -> Result<Series, FrameError>
pub fn cummax(&self) -> Result<Series, FrameError>
GroupBy cumulative maximum.
Sourcepub fn shift(&self, periods: i64) -> Result<Series, FrameError>
pub fn shift(&self, periods: i64) -> Result<Series, FrameError>
GroupBy shift within each group.
Sourcepub fn diff(&self, periods: usize) -> Result<Series, FrameError>
pub fn diff(&self, periods: usize) -> Result<Series, FrameError>
GroupBy difference within each group.
Sourcepub fn pct_change(&self, periods: i64) -> Result<Series, FrameError>
pub fn pct_change(&self, periods: i64) -> Result<Series, FrameError>
GroupBy percentage change within each group.
Sourcepub fn pct_change_with_fill(
&self,
periods: i64,
fill_method: Option<&str>,
limit: Option<usize>,
) -> Result<Series, FrameError>
pub fn pct_change_with_fill( &self, periods: i64, fill_method: Option<&str>, limit: Option<usize>, ) -> Result<Series, FrameError>
pandas’ pct_change(periods, fill_method, limit) of each group: the
group filled forward (ffill / pad) or backward (bfill /
backfill) up to limit, or not at all (None), then filled / filled.shift(periods) - 1 within it. fill_method=None forward-filled
like the default, and a method or limit was refused
(br-frankenpandas-n57tz).
pub fn ffill(&self, limit: Option<usize>) -> Result<Series, FrameError>
Sourcepub fn bfill(&self, limit: Option<usize>) -> Result<Series, FrameError>
pub fn bfill(&self, limit: Option<usize>) -> Result<Series, FrameError>
Backward-fill missing values within each group.
Sourcepub fn fillna(&self, value: &Scalar) -> Result<Series, FrameError>
pub fn fillna(&self, value: &Scalar) -> Result<Series, FrameError>
Fill missing values in each group with a scalar value.
Sourcepub fn rolling(&self, window: usize) -> SeriesGroupByRolling<'_, '_>
pub fn rolling(&self, window: usize) -> SeriesGroupByRolling<'_, '_>
Grouped rolling window operations.
Matches the narrow pd.SeriesGroupBy.rolling(window) reduction shape.
Results are mapped back onto the original flat Series index.
Sourcepub fn expanding(
&self,
min_periods: Option<usize>,
) -> SeriesGroupByExpanding<'_, '_>
pub fn expanding( &self, min_periods: Option<usize>, ) -> SeriesGroupByExpanding<'_, '_>
Grouped expanding window operations.
Matches the narrow pd.SeriesGroupBy.expanding(min_periods=...)
reduction shape. Results are mapped back onto the original flat
Series index.
Sourcepub fn ewm(
&self,
span: Option<f64>,
alpha: Option<f64>,
) -> SeriesGroupByEwm<'_, '_>
pub fn ewm( &self, span: Option<f64>, alpha: Option<f64>, ) -> SeriesGroupByEwm<'_, '_>
Grouped exponentially weighted moving window operations.
Matches the narrow pd.SeriesGroupBy.ewm(span=..., alpha=...)
reduction shape. Results are mapped back onto the original flat
Series index.
Sourcepub fn resample(&self, freq: &str) -> SeriesGroupByResample<'_, '_>
pub fn resample(&self, freq: &str) -> SeriesGroupByResample<'_, '_>
Grouped resampling.
Matches the narrow pd.SeriesGroupBy.resample(freq) reduction shape.
Until row MultiIndex support is real, group and bucket labels are
represented as flat "{group}, {bucket}" labels.
Sourcepub fn nlargest(&self, n: usize) -> Result<Series, FrameError>
pub fn nlargest(&self, n: usize) -> Result<Series, FrameError>
Return up to n largest non-missing values from each group, indexed
by (group key, row label) as pandas’.
Sourcepub fn nsmallest(&self, n: usize) -> Result<Series, FrameError>
pub fn nsmallest(&self, n: usize) -> Result<Series, FrameError>
Return up to n smallest non-missing values from each group, indexed
by (group key, row label) as pandas’.
Sourcepub fn nlargest_keep(&self, n: usize, keep: &str) -> Result<Series, FrameError>
pub fn nlargest_keep(&self, n: usize, keep: &str) -> Result<Series, FrameError>
pandas’ nlargest(n, keep) of each group (Self::nlargest with
‘first’).
Sourcepub fn nsmallest_keep(&self, n: usize, keep: &str) -> Result<Series, FrameError>
pub fn nsmallest_keep(&self, n: usize, keep: &str) -> Result<Series, FrameError>
pandas’ nsmallest(n, keep) of each group (Self::nsmallest with
‘first’).
Sourcepub fn value_counts(&self) -> Result<Series, FrameError>
pub fn value_counts(&self) -> Result<Series, FrameError>
Count non-missing values within each group.
Sourcepub fn value_counts_with_options(
&self,
normalize: bool,
sort: bool,
ascending: bool,
dropna: bool,
) -> Result<Series, FrameError>
pub fn value_counts_with_options( &self, normalize: bool, sort: bool, ascending: bool, dropna: bool, ) -> Result<Series, FrameError>
pandas’ SeriesGroupBy.value_counts(normalize, sort, ascending, dropna): the count of each (group, value), values in sorted order;
sort orders each group by count (descending unless ascending), a
tie keeping value order; dropna=false counts the missing values as
one NaN value, last; normalize divides by the group’s total of what
is counted, as proportion (br-frankenpandas-n57tz: the keywords
were unexpected).
Sourcepub fn describe(&self) -> Result<DataFrame, FrameError>
pub fn describe(&self) -> Result<DataFrame, FrameError>
Summary statistics per group.
Matches pd.SeriesGroupBy.describe() for numeric grouped values.
Sourcepub fn corr(&self, other: &Series) -> Result<Series, FrameError>
pub fn corr(&self, other: &Series) -> Result<Series, FrameError>
Pairwise Pearson correlation with another Series per group.
Sourcepub fn cov(&self, other: &Series) -> Result<Series, FrameError>
pub fn cov(&self, other: &Series) -> Result<Series, FrameError>
Pairwise sample covariance with another Series per group.
Sourcepub fn transform(&self, func: &str) -> Result<Series, FrameError>
pub fn transform(&self, func: &str) -> Result<Series, FrameError>
Broadcast a named per-group reduction back to the original Series shape.
Matches series.groupby(by).transform("mean") for supported reduction
names. The output keeps the original index and length.
Sourcepub fn apply<F>(&self, func: F) -> Result<Series, FrameError>
pub fn apply<F>(&self, func: F) -> Result<Series, FrameError>
Apply a Series-returning function to each group and concatenate results.
Matches the Rust callback shape for series.groupby(by).apply(func).
Returned rows are emitted in the existing SeriesGroupBy first-seen group
order, with flat labels retaining both group key and returned index
label until Series row MultiIndex metadata exists.
Sourcepub fn apply_scalar<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
pub fn apply_scalar<F>(&self, name: &str, func: F) -> Result<Series, FrameError>
Apply a scalar-returning function to each group.
This exposes pandas’ scalar SeriesGroupBy.apply result shape as a
typed Rust API: one value per group, indexed by group keys.
Sourcepub fn filter<F>(&self, func: F) -> Result<Series, FrameError>
pub fn filter<F>(&self, func: F) -> Result<Series, FrameError>
Keep or discard whole groups with a caller-supplied predicate.
Matches series.groupby(by).filter(func): the predicate sees one
per-group Series and the returned Series preserves the original row
order and index labels for groups that pass.
Sourcepub fn pipe<T, F>(&self, func: F) -> Result<T, FrameError>
pub fn pipe<T, F>(&self, func: F) -> Result<T, FrameError>
Pipe this grouped Series through a caller-provided function.
Sourcepub fn head(&self, n: i64) -> Result<Series, FrameError>
pub fn head(&self, n: i64) -> Result<Series, FrameError>
Select first n rows per group, preserving original row order.
Matches pd.SeriesGroupBy.head(n), including pandas’ negative n:
head(-k) keeps all but the last k rows of each group. Verified vs
live pandas 2.2.3.
Sourcepub fn tail(&self, n: i64) -> Result<Series, FrameError>
pub fn tail(&self, n: i64) -> Result<Series, FrameError>
Select last n rows per group, preserving original row order.
Matches pd.SeriesGroupBy.tail(n), including pandas’ negative n:
tail(-k) drops the first k rows of each group. Verified vs live
pandas 2.2.3.
Sourcepub fn take(&self, indices: &[i64]) -> Result<Series, FrameError>
pub fn take(&self, indices: &[i64]) -> Result<Series, FrameError>
Return positional rows from each group.
Matches pd.SeriesGroupBy.take(indices), resolving negative positions
relative to each group’s length.
Sourcepub fn sample(
&self,
n: Option<usize>,
frac: Option<f64>,
replace: bool,
seed: Option<u64>,
) -> Result<Series, FrameError>
pub fn sample( &self, n: Option<usize>, frac: Option<f64>, replace: bool, seed: Option<u64>, ) -> Result<Series, FrameError>
Randomly sample rows from each group.
Matches pd.SeriesGroupBy.sample(n=..., frac=..., replace=...).
Sourcepub fn nth(&self, n: i64) -> Result<Series, FrameError>
pub fn nth(&self, n: i64) -> Result<Series, FrameError>
Select the nth row from each group. Negative n counts from the end.
Sourcepub fn get_group(&self, name: &str) -> Result<Series, FrameError>
pub fn get_group(&self, name: &str) -> Result<Series, FrameError>
Retrieve a single group by its display label.
Sourcepub fn first(&self) -> Result<Series, FrameError>
pub fn first(&self) -> Result<Series, FrameError>
First value of each group.
pub fn last(&self) -> Result<Series, FrameError>
Sourcepub fn size(&self) -> Result<Series, FrameError>
pub fn size(&self) -> Result<Series, FrameError>
Number of elements in each group (including nulls).