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