Skip to content

Commit

Permalink
Fix bug in Series reductions (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzamora authored Apr 26, 2024
1 parent 19052b4 commit 9e0c4db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dask_expr/_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def _lower(self):
if self.shuffle_by_index is not False:
if is_series_like(self._meta) and is_series_like(self.frame._meta):
shuffled = shuffled[shuffled.columns[0]]
if shuffled.name == "__series__":
shuffled = RenameSeries(shuffled, self.frame._meta.name)
elif is_index_like(self._meta):
column = shuffled.columns[0]
divs = None if shuffled.divisions[0] is None else shuffled.divisions
Expand Down
6 changes: 6 additions & 0 deletions dask_expr/tests/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def test_drop_duplicates(pdf, df, split_every, split_out):
)


def test_series_reduction_name():
ser = from_pandas(pd.Series(range(10)), npartitions=2)
df = ser.drop_duplicates().to_frame()
assert_eq(df, df)


@pytest.mark.parametrize("split_every", [False, None, 5])
@pytest.mark.parametrize("split_out", [1, True])
def test_value_counts(pdf, df, split_every, split_out):
Expand Down

0 comments on commit 9e0c4db

Please sign in to comment.