Skip to content

DOC: Add SeriesGroupBy and DataFrameGroupBy reference pages #48500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC: Add SeriesGroupBy and DataFrameGroupBy reference pages
  • Loading branch information
rhshadrach committed Sep 10, 2022
commit f36c897a6638df9fe9f1522d067c98a547700445
156 changes: 94 additions & 62 deletions doc/source/reference/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ Indexing, iteration
.. autosummary::
:toctree: api/

GroupBy.__iter__
GroupBy.groups
GroupBy.indices
GroupBy.get_group
DataFrameGroupBy.__iter__
SeriesGroupBy.__iter__
DataFrameGroupBy.groups
SeriesGroupBy.groups
DataFrameGroupBy.indices
SeriesGroupBy.indices
DataFrameGroupBy.get_group
SeriesGroupBy.get_group

.. currentmodule:: pandas

Expand All @@ -34,57 +38,21 @@ Function application
.. autosummary::
:toctree: api/

GroupBy.apply
GroupBy.agg
SeriesGroupBy.apply
DataFrameGroupBy.apply
SeriesGroupBy.agg
DataFrameGroupBy.agg
SeriesGroupBy.aggregate
DataFrameGroupBy.aggregate
SeriesGroupBy.transform
DataFrameGroupBy.transform
GroupBy.pipe

Computations / descriptive stats
--------------------------------
.. autosummary::
:toctree: api/

GroupBy.all
GroupBy.any
GroupBy.bfill
GroupBy.backfill
GroupBy.count
GroupBy.cumcount
GroupBy.cummax
GroupBy.cummin
GroupBy.cumprod
GroupBy.cumsum
GroupBy.ffill
GroupBy.first
GroupBy.head
GroupBy.last
GroupBy.max
GroupBy.mean
GroupBy.median
GroupBy.min
GroupBy.ngroup
GroupBy.nth
GroupBy.ohlc
GroupBy.pad
GroupBy.prod
GroupBy.rank
GroupBy.pct_change
GroupBy.size
GroupBy.sem
GroupBy.std
GroupBy.sum
GroupBy.var
GroupBy.tail

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.
SeriesGroupBy.pipe
DataFrameGroupBy.pipe
DataFrameGroupBy.filter
SeriesGroupBy.filter

``DataFrameGroupBy`` computations / descriptive stats
-----------------------------------------------------
.. autosummary::
:toctree: api/

Expand All @@ -93,6 +61,7 @@ application to columns of a specific data type.
DataFrameGroupBy.backfill
DataFrameGroupBy.bfill
DataFrameGroupBy.corr
DataFrameGroupBy.corrwith
DataFrameGroupBy.count
DataFrameGroupBy.cov
DataFrameGroupBy.cumcount
Expand All @@ -104,42 +73,105 @@ application to columns of a specific data type.
DataFrameGroupBy.diff
DataFrameGroupBy.ffill
DataFrameGroupBy.fillna
DataFrameGroupBy.filter
DataFrameGroupBy.hist
DataFrameGroupBy.first
DataFrameGroupBy.head
DataFrameGroupBy.idxmax
DataFrameGroupBy.idxmin
DataFrameGroupBy.last
DataFrameGroupBy.mad
DataFrameGroupBy.max
DataFrameGroupBy.mean
DataFrameGroupBy.median
DataFrameGroupBy.min
DataFrameGroupBy.ngroup
DataFrameGroupBy.nth
DataFrameGroupBy.nunique
DataFrameGroupBy.ohlc
DataFrameGroupBy.pad
DataFrameGroupBy.pct_change
DataFrameGroupBy.plot
DataFrameGroupBy.prod
DataFrameGroupBy.quantile
DataFrameGroupBy.rank
DataFrameGroupBy.resample
DataFrameGroupBy.sample
DataFrameGroupBy.sem
DataFrameGroupBy.shift
DataFrameGroupBy.size
DataFrameGroupBy.skew
DataFrameGroupBy.std
DataFrameGroupBy.sum
DataFrameGroupBy.var
DataFrameGroupBy.tail
DataFrameGroupBy.take
DataFrameGroupBy.tshift
DataFrameGroupBy.value_counts

The following methods are available only for ``SeriesGroupBy`` objects.

``SeriesGroupBy`` computations / descriptive stats
--------------------------------------------------
.. autosummary::
:toctree: api/

SeriesGroupBy.hist
SeriesGroupBy.all
SeriesGroupBy.any
SeriesGroupBy.backfill
SeriesGroupBy.bfill
SeriesGroupBy.corr
SeriesGroupBy.count
SeriesGroupBy.cov
SeriesGroupBy.cumcount
SeriesGroupBy.cummax
SeriesGroupBy.cummin
SeriesGroupBy.cumprod
SeriesGroupBy.cumsum
SeriesGroupBy.describe
SeriesGroupBy.diff
SeriesGroupBy.ffill
SeriesGroupBy.fillna
SeriesGroupBy.first
SeriesGroupBy.head
SeriesGroupBy.last
SeriesGroupBy.idxmax
SeriesGroupBy.idxmin
SeriesGroupBy.is_monotonic_increasing
SeriesGroupBy.is_monotonic_decreasing
SeriesGroupBy.mad
SeriesGroupBy.max
SeriesGroupBy.mean
SeriesGroupBy.median
SeriesGroupBy.min
SeriesGroupBy.ngroup
SeriesGroupBy.nlargest
SeriesGroupBy.nsmallest
SeriesGroupBy.nth
SeriesGroupBy.nunique
SeriesGroupBy.unique
SeriesGroupBy.is_monotonic_increasing
SeriesGroupBy.is_monotonic_decreasing

The following methods are available only for ``DataFrameGroupBy`` objects.

SeriesGroupBy.ohlc
SeriesGroupBy.pad
SeriesGroupBy.pct_change
SeriesGroupBy.prod
SeriesGroupBy.quantile
SeriesGroupBy.rank
SeriesGroupBy.resample
SeriesGroupBy.sample
SeriesGroupBy.sem
SeriesGroupBy.shift
SeriesGroupBy.size
SeriesGroupBy.skew
SeriesGroupBy.std
SeriesGroupBy.sum
SeriesGroupBy.var
SeriesGroupBy.tail
SeriesGroupBy.take
SeriesGroupBy.tshift
SeriesGroupBy.value_counts

Plotting and visualization
--------------------------
.. autosummary::
:toctree: api/

DataFrameGroupBy.corrwith
DataFrameGroupBy.boxplot
DataFrameGroupBy.hist
SeriesGroupBy.hist
DataFrameGroupBy.plot
SeriesGroupBy.plot
4 changes: 2 additions & 2 deletions doc/source/user_guide/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,15 @@ See the :ref:`Grouping section <groupby>`.
)
df

Grouping and then applying the :meth:`~pandas.core.groupby.GroupBy.sum` function to the resulting
Grouping and then applying the :meth:`~pandas.core.groupby.DataFrameGroupBy.sum` function to the resulting
groups:

.. ipython:: python

df.groupby("A")[["C", "D"]].sum()

Grouping by multiple columns forms a hierarchical index, and again we can
apply the :meth:`~pandas.core.groupby.GroupBy.sum` function:
apply the :meth:`~pandas.core.groupby.DataFrameGroupBy.sum` function:

.. ipython:: python

Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ Named aggregation
.. versionadded:: 0.25.0

To support column-specific aggregation *with control over the output column names*, pandas
accepts the special syntax in :meth:`GroupBy.agg`, known as "named aggregation", where
accepts the special syntax in :meth:`DataFrameGroupBy.agg` and :meth:`SeriesGroupBy.agg`, known as "named aggregation", where

- The keywords are the *output* column names
- The values are tuples whose first element is the column to select
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9087,7 +9087,8 @@ def rank(

See Also
--------
core.groupby.GroupBy.rank : Rank of values within each group.
core.groupby.DataFrameGroupBy.rank : Rank of values within each group.
core.groupby.SeriesGroupBy.rank : Rank of values within each group.

Examples
--------
Expand Down
12 changes: 6 additions & 6 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2522,9 +2522,9 @@ def first(self, numeric_only: bool = False, min_count: int = -1):
--------
DataFrame.groupby : Apply a function groupby to each row or column of a
DataFrame.
DataFrame.core.groupby.GroupBy.last : Compute the last non-null entry of each
column.
DataFrame.core.groupby.GroupBy.nth : Take the nth row from each group.
pandas.core.groupby.DataFrameGroupBy.last : Compute the last non-null entry
of each column.
pandas.core.groupby.DataFrameGroupBy.nth : Take the nth row from each group.

Examples
--------
Expand Down Expand Up @@ -2594,9 +2594,9 @@ def last(self, numeric_only: bool = False, min_count: int = -1):
--------
DataFrame.groupby : Apply a function groupby to each row or column of a
DataFrame.
DataFrame.core.groupby.GroupBy.first : Compute the first non-null entry of each
column.
DataFrame.core.groupby.GroupBy.nth : Take the nth row from each group.
pandas.core.groupby.DataFrameGroupBy.first : Compute the first non-null entry
of each column.
pandas.core.groupby.DataFrameGroupBy.nth : Take the nth row from each group.

Examples
--------
Expand Down
2 changes: 2 additions & 0 deletions scripts/validate_rst_title_capitalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"CategoricalIndex",
"Categorical",
"GroupBy",
"DataFrameGroupBy",
"SeriesGroupBy",
"SPSS",
"ORC",
"R",
Expand Down