Skip to content

Commit

Permalink
revise
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzamora committed Oct 9, 2023
1 parent 142579f commit 69ab999
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dask/dataframe/partitionquantiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ def percentiles_to_weights(qs, vals, length):
return ()
diff = np.ediff1d(qs, 0.0, 0.0)
weights = 0.5 * length * (diff[1:] + diff[:-1])
return tolist_dispatch(vals), weights.tolist()
try:
# Try using tolist_dispatch first
return tolist_dispatch(vals), weights.tolist()
except TypeError:
return vals.tolist(), weights.tolist()


def merge_and_compress_summaries(vals_and_weights):
Expand Down
2 changes: 2 additions & 0 deletions dask/dataframe/tests/test_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,8 @@ def test_sort_values(nelem, by, ascending):
@pytest.mark.parametrize("by", ["x", "z", ["x", "z"], ["z", "x"]])
@pytest.mark.parametrize("ascending", [True, False])
def test_sort_values_tasks_backend(backend, by, ascending):
if backend == "cudf":
pytest.importorskip("dask_cudf")
pdf = pd.DataFrame(
{"x": range(10), "y": [1, 2, 3, 4, 5] * 2, "z": ["cat", "dog"] * 5}
)
Expand Down

0 comments on commit 69ab999

Please sign in to comment.