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

Function test_sample

dask/dataframe/tests/test_dataframe.py:2487–2502  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2485
2486
2487def test_sample():
2488 df = pd.DataFrame(
2489 {"x": [1, 2, 3, 4, None, 6], "y": list("abdabd")},
2490 index=[10, 20, 30, 40, 50, 60],
2491 )
2492 a = dd.from_pandas(df, 2)
2493
2494 b = a.sample(frac=0.5)
2495
2496 assert_eq(b, b)
2497
2498 c = a.sample(frac=0.5, random_state=1234)
2499 d = a.sample(frac=0.5, random_state=1234)
2500 assert_eq(c, d)
2501
2502 assert a.sample(frac=0.5)._name != a.sample(frac=0.5)._name
2503
2504
2505def test_sample_without_replacement():

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
sampleMethod · 0.80

Tested by

no test coverage detected