Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use _concat for repartition #626

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dask_expr/_repartition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pandas as pd
from dask.base import tokenize
from dask.dataframe import methods
from dask.dataframe.core import _map_freq_to_period_start, split_evenly
from dask.dataframe.core import _concat, _map_freq_to_period_start, split_evenly
from dask.dataframe.utils import is_series_like
from dask.utils import iter_chunks, parse_bytes
from pandas.api.types import is_datetime64_any_dtype, is_numeric_dtype
Expand Down Expand Up @@ -161,7 +161,7 @@ def _layer(self):
new_partitions_boundaries = self._partitions_boundaries
return {
(self._name, i): (
methods.concat,
_concat,
[(self.frame._name, j) for j in range(start, end)],
)
for i, (start, end) in enumerate(
Expand Down
8 changes: 8 additions & 0 deletions dask_expr/tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import dask
import numpy as np
import pandas as pd
import pytest
from dask.dataframe._compat import PANDAS_GE_210
from dask.dataframe.utils import UNKNOWN_CATEGORIES
Expand Down Expand Up @@ -1918,3 +1919,10 @@ def test_axes(df, pdf):
[assert_eq(d, p) for d, p in zip(df.axes, pdf.axes)]
assert len(df.x.axes) == len(pdf.x.axes)
assert_eq(df.x.axes[0], pdf.x.axes[0])


def test_map_partitions_series(df, pdf):
result = df.x.map_partitions(M.min).compute()
assert isinstance(result, pd.Series)
assert len(result) == df.npartitions
assert min(pdf.x) == min(result)
Loading