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

Function test_split_out_drop_duplicates

dask/dataframe/tests/test_dataframe.py:4010–4027  ·  view source on GitHub ↗
(split_every)

Source from the content-addressed store, hash-verified

4008
4009@pytest.mark.parametrize("split_every", [None, 2])
4010def test_split_out_drop_duplicates(split_every):
4011 x = np.concatenate([np.arange(10)] * 100)[:, None]
4012 y = x.copy()
4013 z = np.concatenate([np.arange(20)] * 50)[:, None]
4014 rs = np.random.RandomState(1)
4015 rs.shuffle(x)
4016 rs.shuffle(y)
4017 rs.shuffle(z)
4018 df = pd.DataFrame(np.concatenate([x, y, z], axis=1), columns=["x", "y", "z"])
4019 ddf = dd.from_pandas(df, npartitions=20)
4020
4021 for subset, keep in product([None, ["x", "z"]], ["first", "last"]):
4022 sol = df.drop_duplicates(subset=subset, keep=keep)
4023 res = ddf.drop_duplicates(
4024 subset=subset, keep=keep, split_every=split_every, split_out=10
4025 )
4026 assert res.npartitions == 10
4027 assert_eq(sol, res)
4028
4029
4030@pytest.mark.parametrize("split_every", [None, 2])

Callers

nothing calls this directly

Calls 7

drop_duplicatesMethod · 0.95
assert_eqFunction · 0.90
arangeMethod · 0.45
copyMethod · 0.45
RandomStateMethod · 0.45
shuffleMethod · 0.45
drop_duplicatesMethod · 0.45

Tested by

no test coverage detected