From 97f1695dfbe3269e5c5f8b44f8983540481bf626 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Tue, 19 Dec 2023 10:58:11 -0700 Subject: [PATCH] Fix docs --- doc/user-guide/groupby.rst | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/doc/user-guide/groupby.rst b/doc/user-guide/groupby.rst index dce20dce228..1ad2d52fc00 100644 --- a/doc/user-guide/groupby.rst +++ b/doc/user-guide/groupby.rst @@ -177,28 +177,18 @@ This last line is roughly equivalent to the following:: results.append(group - alt.sel(letters=label)) xr.concat(results, dim='x') -Squeezing -~~~~~~~~~ +Iterating and Squeezing +~~~~~~~~~~~~~~~~~~~~~~~ -When grouping over a dimension, you can control whether the dimension is -squeezed out or if it should remain with length one on each group by using -the ``squeeze`` parameter: - -.. ipython:: python - - next(iter(arr.groupby("x"))) +Previously, Xarray defaulted to squeezing out dimensions of size one when iterating over +a GroupBy object. This behaviour is being removed. +You can always squeeze explicitly later with the Dataset or DataArray +:py:meth:`~xarray.DataArray.squeeze` methods. .. ipython:: python next(iter(arr.groupby("x", squeeze=False))) -Although xarray will attempt to automatically -:py:attr:`~xarray.DataArray.transpose` dimensions back into their original order -when you use apply, it is sometimes useful to set ``squeeze=False`` to -guarantee that all original dimensions remain unchanged. - -You can always squeeze explicitly later with the Dataset or DataArray -:py:meth:`~xarray.DataArray.squeeze` methods. .. _groupby.multidim: