Skip to content

Commit 4ad5ae0

Browse files
committed
Squashed commit of the following:
commit 0a0f800 Merge: 33c8033 41d33f5 Author: Deepak Cherian <[email protected]> Date: Tue Jan 2 20:42:51 2024 -0700 Merge branch 'main' into depr-groupby-squeeze-2 commit 33c8033 Author: Deepak Cherian <[email protected]> Date: Tue Jan 2 20:40:42 2024 -0700 Don't skip for resampling commit d7be352 Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed Jan 3 03:24:13 2024 +0000 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci commit d13fa0e Author: Deepak Cherian <[email protected]> Date: Tue Jan 2 20:23:43 2024 -0700 Apply suggestions from code review Co-authored-by: Michael Niklas <[email protected]> commit dd6ea53 Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 19:29:40 2023 -0700 Silence more warnings commit 44e5a41 Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 19:21:06 2023 -0700 minimize test mods commit 94c1c1f Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 18:55:46 2023 -0700 Add tests for pydata#8263 commit 0ab4eb6 Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 18:47:41 2023 -0700 Fix typing commit a064430 Merge: d6a3f2d 03ec3cb Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 18:47:04 2023 -0700 Merge branch 'main' into depr-groupby-squeeze-2 * main: Fix mypy type ignore (pydata#8564) Support for the new compression arguments. (pydata#7551) FIX: reverse index output of bottleneck move_argmax/move_argmin functions (pydata#8552) Adapt map_blocks to use new Coordinates API (pydata#8560) add xeofs to ecosystem.rst (pydata#8561) Offer a fixture for unifying DataArray & Dataset tests (pydata#8533) Generalize cumulative reduction (scan) to non-dask types (pydata#8019) commit d6a3f2d Author: Deepak Cherian <[email protected]> Date: Thu Dec 21 18:46:50 2023 -0700 Fix generator for aggregations commit 97f1695 Author: Deepak Cherian <[email protected]> Date: Tue Dec 19 10:58:11 2023 -0700 Fix docs commit 5b33b98 Author: Deepak Cherian <[email protected]> Date: Sun Dec 17 20:35:53 2023 -0700 fix whats-new commit 80b2b36 Author: Deepak Cherian <[email protected]> Date: Sun Dec 17 20:26:17 2023 -0700 Reduce more warnings commit 5f6f4ea Merge: a57d4ae 2971994 Author: Deepak Cherian <[email protected]> Date: Sat Dec 16 20:33:13 2023 -0700 Merge branch 'main' into depr-groupby-squeeze-2 * main: (26 commits) Filter null values before plotting (pydata#8535) Update concat.py (pydata#8538) Add getitem to array protocol (pydata#8406) Added option to specify weights in xr.corr() and xr.cov() (pydata#8527) Filter out doctest warning (pydata#8539) Bump actions/setup-python from 4 to 5 (pydata#8540) Point users to where in their code they should make mods for Dataset.dims (pydata#8534) Add Cumulative aggregation (pydata#8512) dev whats-new Whats-new for 2023.12.0 (pydata#8532) explicitly skip using `__array_namespace__` for `numpy.ndarray` (pydata#8526) Add `eval` method to Dataset (pydata#7163) Deprecate ds.dims returning dict (pydata#8500) test and fix empty xindexes repr (pydata#8521) Remove PR labeler bot (pydata#8525) Hypothesis strategy for generating Variable objects (pydata#8404) Use numbagg for `rolling` methods (pydata#8493) Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11 (pydata#8514) fix RTD docs build (pydata#8519) Fix type of `.assign_coords` (pydata#8495) ... commit a57d4ae Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 21:36:04 2023 -0700 Test one more warning commit bf8139d Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 21:33:45 2023 -0700 Update xarray/tests/test_groupby.py commit 4e9a063 Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 21:10:14 2023 -0700 Set squeeze=None for Dataset too commit c2e576e Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 20:54:17 2023 -0700 Fix first, last commit 6d8e822 Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 20:46:21 2023 -0700 better warning commit 62c334b Author: Deepak Cherian <[email protected]> Date: Fri Dec 1 20:45:17 2023 -0700 silence warnings commit b7805a8 Author: dcherian <[email protected]> Date: Tue Aug 15 10:54:25 2023 -0600 Deprecate `squeeze` in GroupBy. Closes pydata#2157
1 parent 41d33f5 commit 4ad5ae0

File tree

12 files changed

+638
-171
lines changed

12 files changed

+638
-171
lines changed

doc/user-guide/groupby.rst

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,28 +177,18 @@ This last line is roughly equivalent to the following::
177177
results.append(group - alt.sel(letters=label))
178178
xr.concat(results, dim='x')
179179

180-
Squeezing
181-
~~~~~~~~~
180+
Iterating and Squeezing
181+
~~~~~~~~~~~~~~~~~~~~~~~
182182

183-
When grouping over a dimension, you can control whether the dimension is
184-
squeezed out or if it should remain with length one on each group by using
185-
the ``squeeze`` parameter:
186-
187-
.. ipython:: python
188-
189-
next(iter(arr.groupby("x")))
183+
Previously, Xarray defaulted to squeezing out dimensions of size one when iterating over
184+
a GroupBy object. This behaviour is being removed.
185+
You can always squeeze explicitly later with the Dataset or DataArray
186+
:py:meth:`~xarray.DataArray.squeeze` methods.
190187

191188
.. ipython:: python
192189
193190
next(iter(arr.groupby("x", squeeze=False)))
194191
195-
Although xarray will attempt to automatically
196-
:py:attr:`~xarray.DataArray.transpose` dimensions back into their original order
197-
when you use apply, it is sometimes useful to set ``squeeze=False`` to
198-
guarantee that all original dimensions remain unchanged.
199-
200-
You can always squeeze explicitly later with the Dataset or DataArray
201-
:py:meth:`~xarray.DataArray.squeeze` methods.
202192
203193
.. _groupby.multidim:
204194

doc/whats-new.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Breaking changes
3737

3838
Deprecations
3939
~~~~~~~~~~~~
40-
40+
- The `squeeze` kwarg to GroupBy is now deprecated. (:issue:`2157`, :pull:`8507`)
41+
By `Deepak Cherian <https://github.com/dcherian>`_.
4142

4243
Bug fixes
4344
~~~~~~~~~
@@ -116,7 +117,6 @@ Breaking changes
116117

117118
Deprecations
118119
~~~~~~~~~~~~
119-
120120
- As part of an effort to standardize the API, we're renaming the ``dims``
121121
keyword arg to ``dim`` for the minority of functions which current use
122122
``dims``. This started with :py:func:`xarray.dot` & :py:meth:`DataArray.dot`

0 commit comments

Comments
 (0)