Skip to content

Commit 006db75

Browse files
committed
DOC: add notes to the groupby.rst docs
1 parent a67c672 commit 006db75

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

doc/source/groupby.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,16 @@ index are the group names and whose values are the sizes of each group.
389389
390390
.. note::
391391

392-
Aggregation functions will **not** return the groups that you are aggregating over
393-
if they are named *columns*. The grouped columns will be the **indices** of the returned object.
392+
Aggregation functions **will not** return the groups that you are aggregating over
393+
if they are named *columns*, when ``as_index=True``, the default. The grouped columns will
394+
be the **indices** of the returned object.
395+
396+
Passing ``as_index=False`` **will** return the groups that you are aggregating over, if they are
397+
named *columns*.
398+
394399
Aggregating functions are ones that reduce the dimension of the returned objects,
395400
for example: ``mean, sum, size, count, std, var, describe, first, last, min, max``. This is
396-
very much like performing a redcing operation on a ``DataFrame`` and getting a ``Series`` back.
401+
what happens when you do for example ``DataFrame.sum()`` and get back a ``Series``.
397402

398403
.. _groupby.aggregate.multifunc:
399404

@@ -552,7 +557,9 @@ and that the transformed data contains no NAs.
552557
.. note::
553558

554559
Some functions when applied to a groupby object will automatically transform the input, returning
555-
an object of the same shape as the original. For example: ``fillna, ffill, bfill, shift``.
560+
an object of the same shape as the original. Passing ``as_index=False`` will not affect these transformation methods.
561+
562+
For example: ``fillna, ffill, bfill, shift``.
556563

557564
.. ipython:: python
558565
@@ -604,6 +611,8 @@ For dataframes with multiple columns, filters should explicitly specify a column
604611

605612
Some functions when applied to a groupby object will act as a **filter** on the input, returning
606613
a reduced shape of the original (and potentitally eliminating groups), but with the index unchanged.
614+
Passing ``as_index=False`` will not affect these transformation methods.
615+
607616
For example: ``head, tail nth``.
608617

609618
.. ipython:: python

0 commit comments

Comments
 (0)