@@ -874,7 +874,12 @@ def rolling_exp(
874
874
875
875
return rolling_exp .RollingExp (self , window , window_type )
876
876
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 :
878
883
"""
879
884
Sort or "shuffle" this object by a Grouper.
880
885
@@ -886,6 +891,12 @@ def shuffle_by(self, **groupers: Grouper) -> Self:
886
891
887
892
Parameters
888
893
----------
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.
889
900
**groupers : Grouper
890
901
Grouper objects using which to shuffle the data.
891
902
@@ -923,7 +934,7 @@ def shuffle_by(self, **groupers: Grouper) -> Self:
923
934
dask.dataframe.DataFrame.shuffle
924
935
dask.array.shuffle
925
936
"""
926
- return self .groupby (** groupers )._shuffle_obj ()
937
+ return self .groupby (group = group , ** groupers )._shuffle_obj (chunks )
927
938
928
939
def _resample (
929
940
self ,
0 commit comments