Skip to content

Commit da23871

Browse files
max-sixtydcherian
authored andcommitted
Add example to docs
fix docs [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
1 parent da7e67b commit da23871

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

doc/user-guide/groupby.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ You can index out a particular group:
8181
8282
ds.groupby("letters")["b"]
8383
84-
Just like in pandas, creating a GroupBy object is cheap: it does not actually
84+
Just like in pandas, creating a ``GroupBy`` object is cheap: it does not actually
8585
split the data until you access particular values.
8686

87+
To group by multiple variables, see the section on `Grouper Objects`_
88+
8789
Binning
8890
~~~~~~~
8991

@@ -276,7 +278,15 @@ is identical to
276278
277279
ds.groupby(x=UniqueGrouper())
278280
279-
and
281+
We can use this to group by multiple dimensions:
282+
283+
.. ipython:: python
284+
285+
from xarray.groupers import UniqueGrouper
286+
287+
ds.groupby(lat=UniqueGrouper(), lon=UniqueGrouper()).sum()
288+
289+
Similarly,
280290

281291
.. code-block:: python
282292

0 commit comments

Comments
 (0)