GroupBy#
pandas.api.typing.DataFrameGroupBy
and pandas.api.typing.SeriesGroupBy
instances are returned by groupby calls pandas.DataFrame.groupby()
and
pandas.Series.groupby()
respectively.
Indexing, iteration#
Groupby iterator. |
|
Groupby iterator. |
|
Dict {group name -> group labels}. |
|
Dict {group name -> group labels}. |
|
Dict {group name -> group indices}. |
|
Dict {group name -> group indices}. |
|
|
Construct DataFrame from group with provided name. |
|
Construct DataFrame from group with provided name. |
|
A Grouper allows the user to specify a groupby instruction for an object. |
Function application helper#
|
Helper for column specific aggregation with control over output column names. |
Function application#
|
Apply function |
|
Apply function |
|
Aggregate using one or more operations over the specified axis. |
|
Aggregate using one or more operations over the specified axis. |
|
Aggregate using one or more operations over the specified axis. |
|
Aggregate using one or more operations over the specified axis. |
|
Call function producing a same-indexed Series on each group. |
|
Call function producing a same-indexed DataFrame on each group. |
|
Apply a |
|
Apply a |
|
Filter elements from groups that don't satisfy a criterion. |
|
Filter elements from groups that don't satisfy a criterion. |
DataFrameGroupBy
computations / descriptive stats#
|
Return True if all values in the group are truthful, else False. |
|
Return True if any value in the group is truthful, else False. |
|
Backward fill the values. |
|
Compute pairwise correlation of columns, excluding NA/null values. |
|
Compute pairwise correlation. |
Compute count of group, excluding missing values. |
|
|
Compute pairwise covariance of columns, excluding NA/null values. |
|
Number each item in each group from 0 to the length of that group - 1. |
|
Cumulative max for each group. |
|
Cumulative min for each group. |
|
Cumulative product for each group. |
|
Cumulative sum for each group. |
|
Generate descriptive statistics. |
|
First discrete difference of element. |
|
Forward fill the values. |
|
Fill NA/NaN values using the specified method within groups. |
|
Compute the first non-null entry of each column. |
Return first n rows of each group. |
|
|
Return index of first occurrence of maximum over requested axis. |
|
Return index of first occurrence of minimum over requested axis. |
|
Compute the last non-null entry of each column. |
|
Compute max of group values. |
|
Compute mean of groups, excluding missing values. |
|
Compute median of groups, excluding missing values. |
|
Compute min of group values. |
|
Number each group from 0 to the number of groups - 1. |
Take the nth row from each group if n is an int, otherwise a subset of rows. |
|
|
Return DataFrame with counts of unique elements in each position. |
Compute open, high, low and close values of a group, excluding missing values. |
|
|
Calculate pct_change of each value to previous entry in group. |
|
Compute prod of group values. |
|
Return group values at the given quantile, a la numpy.percentile. |
|
Provide the rank of values within each group. |
|
Provide resampling when using a TimeGrouper. |
|
Return a rolling grouper, providing rolling functionality per group. |
|
Return a random sample of items from each group. |
|
Compute standard error of the mean of groups, excluding missing values. |
|
Shift each group by periods observations. |
Compute group sizes. |
|
|
Return unbiased skew within groups. |
|
Compute standard deviation of groups, excluding missing values. |
|
Compute sum of group values. |
|
Compute variance of groups, excluding missing values. |
Return last n rows of each group. |
|
|
Return the elements in the given positional indices in each group. |
|
Return a Series or DataFrame containing counts of unique rows. |
SeriesGroupBy
computations / descriptive stats#
|
Return True if all values in the group are truthful, else False. |
|
Return True if any value in the group is truthful, else False. |
|
Backward fill the values. |
|
Compute correlation with other Series, excluding missing values. |
Compute count of group, excluding missing values. |
|
|
Compute covariance with Series, excluding missing values. |
|
Number each item in each group from 0 to the length of that group - 1. |
|
Cumulative max for each group. |
|
Cumulative min for each group. |
|
Cumulative product for each group. |
|
Cumulative sum for each group. |
|
Generate descriptive statistics. |
|
First discrete difference of element. |
|
Forward fill the values. |
|
Fill NA/NaN values using the specified method within groups. |
|
Compute the first non-null entry of each column. |
|
Return first n rows of each group. |
|
Compute the last non-null entry of each column. |
|
Return the row label of the maximum value. |
|
Return the row label of the minimum value. |
Return whether each group's values are monotonically increasing. |
|
Return whether each group's values are monotonically decreasing. |
|
|
Compute max of group values. |
|
Compute mean of groups, excluding missing values. |
|
Compute median of groups, excluding missing values. |
|
Compute min of group values. |
|
Number each group from 0 to the number of groups - 1. |
|
Return the largest n elements. |
|
Return the smallest n elements. |
Take the nth row from each group if n is an int, otherwise a subset of rows. |
|
|
Return number of unique elements in the group. |
Return unique values for each group. |
|
Compute open, high, low and close values of a group, excluding missing values. |
|
|
Calculate pct_change of each value to previous entry in group. |
|
Compute prod of group values. |
|
Return group values at the given quantile, a la numpy.percentile. |
|
Provide the rank of values within each group. |
|
Provide resampling when using a TimeGrouper. |
|
Return a rolling grouper, providing rolling functionality per group. |
|
Return a random sample of items from each group. |
|
Compute standard error of the mean of groups, excluding missing values. |
|
Shift each group by periods observations. |
Compute group sizes. |
|
|
Return unbiased skew within groups. |
|
Compute standard deviation of groups, excluding missing values. |
|
Compute sum of group values. |
|
Compute variance of groups, excluding missing values. |
|
Return last n rows of each group. |
|
Return the elements in the given positional indices in each group. |
|
Plotting and visualization#
|
Make box plots from DataFrameGroupBy data. |
|
Make a histogram of the DataFrame's columns. |
|
Draw histogram of the input series using matplotlib. |
Make plots of Series or DataFrame. |
|
Make plots of Series or DataFrame. |