Skip to content

Commit 75115d0

Browse files
committed
Fix
1 parent ead1bb4 commit 75115d0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

xarray/core/common.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,12 @@ def rolling_exp(
874874

875875
return rolling_exp.RollingExp(self, window, window_type)
876876

877-
def shuffle_by(self, **groupers: Grouper) -> Self:
877+
def shuffle_by(
878+
self,
879+
group: Hashable | DataArray | Mapping[Any, Grouper] | None = None,
880+
chunks: T_Chunks = None,
881+
**groupers: Grouper,
882+
) -> Self:
878883
"""
879884
Sort or "shuffle" this object by a Grouper.
880885
@@ -886,6 +891,12 @@ def shuffle_by(self, **groupers: Grouper) -> Self:
886891
887892
Parameters
888893
----------
894+
group : Hashable or DataArray or IndexVariable or mapping of Hashable to Grouper
895+
Array whose unique values should be used to group this array. If a
896+
Hashable, must be the name of a coordinate contained in this dataarray. If a dictionary,
897+
must map an existing variable name to a :py:class:`Grouper` instance.
898+
chunks : int, tuple of int, "auto" or mapping of hashable to int or a TimeResampler, optional
899+
How to adjust chunks along dimensions not present in the array being grouped by.
889900
**groupers : Grouper
890901
Grouper objects using which to shuffle the data.
891902
@@ -923,7 +934,7 @@ def shuffle_by(self, **groupers: Grouper) -> Self:
923934
dask.dataframe.DataFrame.shuffle
924935
dask.array.shuffle
925936
"""
926-
return self.groupby(**groupers)._shuffle_obj()
937+
return self.groupby(group=group, **groupers)._shuffle_obj(chunks)
927938

928939
def _resample(
929940
self,

0 commit comments

Comments
 (0)