GroupBy¶
GroupBy objects are returned by groupby calls: pandas.DataFrame.groupby()
, pandas.Series.groupby()
, etc.
Indexing, iteration¶
Groupby iterator. |
|
Dict {group name -> group labels}. |
|
Dict {group name -> group indices}. |
|
|
Construct DataFrame from group with provided name. |
|
A Grouper allows the user to specify a groupby instruction for an object. |
Function application¶
|
Apply function |
|
|
|
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 |
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. |
|
Backward fill the values. |
Compute count of group, 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. |
|
Forward fill the values. |
|
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. |
|
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. |
Compute open, high, low and close values of a group, excluding missing values. |
|
|
Forward fill the values. |
|
Compute prod of group values. |
|
Provide the rank of values within each group. |
|
Calculate pct_change of each value to previous entry in group. |
Compute group sizes. |
|
|
Compute standard error of the mean of groups, excluding missing values. |
|
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. |
The following methods are available in both SeriesGroupBy
and
DataFrameGroupBy
objects, but may differ slightly, usually in that
the DataFrameGroupBy
version usually permits the specification of an
axis argument, and often an argument indicating whether to restrict
application to columns of a specific data type.
|
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. |
|
Backward fill the values. |
Compute pairwise correlation of columns, excluding NA/null values. |
|
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. |
|
|
Return a copy of a DataFrame excluding filtered elements. |
Make a histogram of the DataFrame's columns. |
|
|
Return index of first occurrence of maximum over requested axis. |
|
Return index of first occurrence of minimum over requested axis. |
(DEPRECATED) Return the mean absolute deviation of the values over the requested axis. |
|
|
Return DataFrame with counts of unique elements in each position. |
|
Forward fill the values. |
|
Calculate pct_change of each value to previous entry in group. |
Class implementing the .plot attribute for groupby objects. |
|
|
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 random sample of items from each group. |
|
Shift each group by periods observations. |
Compute group sizes. |
|
Return unbiased skew over requested axis. |
|
Return the elements in the given positional indices along an axis. |
|
(DEPRECATED) Shift the time index, using the index's frequency if available. |
|
|
Return a Series or DataFrame containing counts of unique rows. |
The following methods are available only for SeriesGroupBy
objects.
Draw histogram of the input series using matplotlib. |
|
|
Return the largest n elements. |
|
Return the smallest n elements. |
Return unique values of Series object. |
|
Return boolean if values in the object are monotonically increasing. |
|
Return boolean if values in the object are monotonically decreasing. |
The following methods are available only for DataFrameGroupBy
objects.
Compute pairwise correlation. |
|
|
Make box plots from DataFrameGroupBy data. |