Skip to content

Commit cda4015

Browse files
Merge pull request #8811 from MatthewGilbert/master
DOC: Added get_group() example to grouby.html
2 parents 6f48d4a + cb9f3a9 commit cda4015

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ If you want to do a full clean build, do::
132132
python make.py build
133133

134134

135-
Staring with 0.13.1 you can tell ``make.py`` to compile only a single section
135+
Starting with 0.13.1 you can tell ``make.py`` to compile only a single section
136136
of the docs, greatly reducing the turn-around time for checking your changes.
137137
You will be prompted to delete `.rst` files that aren't required, since the
138138
last committed version can always be restored from git.

doc/source/groupby.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,21 @@ In the case of grouping by multiple keys, the group name will be a tuple:
338338
It's standard Python-fu but remember you can unpack the tuple in the for loop
339339
statement if you wish: ``for (k1, k2), group in grouped:``.
340340

341+
Selecting a group
342+
-----------------
343+
344+
A single group can be selected using ``GroupBy.get_group()``:
345+
346+
.. ipython:: python
347+
348+
grouped.get_group('bar')
349+
350+
Or for an object grouped on multiple columns:
351+
352+
.. ipython:: python
353+
354+
df.groupby(['A', 'B']).get_group(('bar', 'one'))
355+
341356
.. _groupby.aggregate:
342357

343358
Aggregation

0 commit comments

Comments
 (0)