Skip to content

Commit

Permalink
Remove deprecation warning about sort and split_out in groupby (#10788)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Jan 12, 2024
1 parent ca71e15 commit feaff0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
21 changes: 0 additions & 21 deletions dask/dataframe/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@
#
# #############################################

SORT_SPLIT_OUT_WARNING = (
"In the future, `sort` for groupby operations will default to `True`"
" to match the behavior of pandas. However, `sort=True` does not work"
" with `split_out>1`. To retain the current behavior for multiple"
" output partitions, set `sort=False`."
)

NUMERIC_ONLY_NOT_IMPLEMENTED = [
"mean",
"std",
Expand Down Expand Up @@ -1534,9 +1527,6 @@ def _single_agg(
"""
shuffle = _determine_split_out_shuffle(shuffle, split_out)

if self.sort is None and split_out > 1:
warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning)

if aggfunc is None:
aggfunc = func

Expand Down Expand Up @@ -2050,9 +2040,6 @@ def var(self, ddof=1, split_every=None, split_out=1, numeric_only=no_default):
if not PANDAS_GE_150 and numeric_only is not no_default:
raise TypeError("numeric_only not supported for pandas < 1.5")

if self.sort is None and split_out > 1:
warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning)

levels = _determine_levels(self.by)
result = aca(
[self.obj, self.by]
Expand Down Expand Up @@ -2131,8 +2118,6 @@ def cov(
if not PANDAS_GE_150 and numeric_only is not no_default:
raise TypeError("numeric_only not supported for pandas < 1.5")
numeric_only_kwargs = get_numeric_only_kwargs(numeric_only)
if self.sort is None and split_out > 1:
warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning)

levels = _determine_levels(self.by)

Expand Down Expand Up @@ -2387,9 +2372,6 @@ def aggregate(
sort=self.sort,
)
else:
if self.sort is None and split_out > 1:
warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning)

# Check sort behavior
if self.sort and split_out > 1:
raise NotImplementedError(
Expand Down Expand Up @@ -3013,9 +2995,6 @@ def nunique(self, split_every=None, split_out=1):
else:
chunk = _nunique_series_chunk

if self.sort is None and split_out > 1:
warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning)

return aca(
[self.obj, self.by]
if not isinstance(self.by, list)
Expand Down
5 changes: 3 additions & 2 deletions dask/dataframe/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3302,8 +3302,9 @@ def test_groupby_sort_true_split_out():
M.sum(ddf.groupby("x", sort=False), split_out=2)

# Warns for sort=None
with pytest.warns(FutureWarning, match="split_out>1"):
M.sum(ddf.groupby("x"), split_out=2)
with pytest.warns(None):
ddf.groupby("x").sum(split_out=2)
ddf.groupby("x").agg("sum", split_out=2)

with pytest.raises(NotImplementedError):
# Cannot use sort=True with split_out>1 using non-shuffle-based approach
Expand Down

0 comments on commit feaff0b

Please sign in to comment.