Skip to content

Commit

Permalink
Add example to docs
Browse files Browse the repository at this point in the history
fix docs

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
  • Loading branch information
max-sixty authored and dcherian committed Aug 21, 2024
1 parent 76273eb commit 7ec2341
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions doc/user-guide/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ You can index out a particular group:
ds.groupby("letters")["b"]
Just like in pandas, creating a GroupBy object is cheap: it does not actually
Just like in pandas, creating a ``GroupBy`` object is cheap: it does not actually
split the data until you access particular values.

To group by multiple variables, see the section on `Grouper Objects`_

Binning
~~~~~~~

Expand Down Expand Up @@ -276,7 +278,15 @@ is identical to
ds.groupby(x=UniqueGrouper())
and
We can use this to group by multiple dimensions:

.. ipython:: python
from xarray.groupers import UniqueGrouper
ds.groupby(lat=UniqueGrouper(), lon=UniqueGrouper()).sum()
Similarly,

.. code-block:: python
Expand Down

0 comments on commit 7ec2341

Please sign in to comment.