MCPcopy Create free account
hub / github.com/dask/dask / test_sort_values

Function test_sort_values

dask/dataframe/dask_expr/tests/test_shuffle.py:347–366  ·  view source on GitHub ↗
(df, pdf, shuffle)

Source from the content-addressed store, hash-verified

345
346@pytest.mark.parametrize("shuffle", [None, "tasks"])
347def test_sort_values(df, pdf, shuffle):
348 assert_eq(df.sort_values("x", shuffle_method=shuffle), pdf.sort_values("x"))
349 assert_eq(
350 df.sort_values("x", shuffle_method=shuffle, npartitions=2), pdf.sort_values("x")
351 )
352 pdf.iloc[5, 0] = -10
353 df = from_pandas(pdf, npartitions=10)
354 assert_eq(
355 df.sort_values("x", shuffle_method=shuffle, upsample=2.0), pdf.sort_values("x")
356 )
357
358 assert_eq(
359 df.sort_values(by=["x", "y"], shuffle_method=shuffle, ascending=[True, True]),
360 pdf.sort_values(by=["x", "y"], ascending=[True, True]),
361 )
362 with pytest.raises(NotImplementedError, match="sorting by named columns"):
363 df.sort_values(by=1, shuffle_method=shuffle)
364
365 with pytest.raises(ValueError, match="must be either 'first' or 'last'"):
366 df.sort_values(by="x", shuffle_method=shuffle, na_position="bla")
367
368
369@pytest.mark.parametrize("shuffle", [None, "tasks"])

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
from_pandasFunction · 0.90
sort_valuesMethod · 0.80

Tested by

no test coverage detected