()
| 2485 | |
| 2486 | |
| 2487 | def 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 | |
| 2505 | def test_sample_without_replacement(): |