(c, tmpdir, io, from_futures)
| 529 | ) |
| 530 | @pytest.mark.parametrize("from_futures", [True, False]) |
| 531 | def test_blockwise_dataframe_io(c, tmpdir, io, from_futures): |
| 532 | pd = pytest.importorskip("pandas") |
| 533 | dd = pytest.importorskip("dask.dataframe") |
| 534 | |
| 535 | df = pd.DataFrame({"x": [1, 2, 3] * 5, "y": range(15)}) |
| 536 | |
| 537 | if from_futures: |
| 538 | parts = [df.iloc[:5], df.iloc[5:10], df.iloc[10:15]] |
| 539 | futs = c.scatter(parts) |
| 540 | ddf0 = dd.from_delayed(futs, meta=parts[0]) |
| 541 | else: |
| 542 | ddf0 = dd.from_pandas(df, npartitions=3) |
| 543 | |
| 544 | if io == "parquet": |
| 545 | pytest.importorskip("pyarrow") |
| 546 | ddf0.to_parquet(str(tmpdir)) |
| 547 | ddf = dd.read_parquet(str(tmpdir)) |
| 548 | elif io == "csv": |
| 549 | ddf0.to_csv(str(tmpdir), index=False) |
| 550 | ddf = dd.read_csv(os.path.join(str(tmpdir), "*")) |
| 551 | elif io == "hdf": |
| 552 | pytest.importorskip("tables") |
| 553 | fn = str(tmpdir.join("h5")) |
| 554 | ddf0.to_hdf(fn, "/data*") |
| 555 | ddf = dd.read_hdf(fn, "/data*") |
| 556 | else: |
| 557 | raise AssertionError("unreachable") |
| 558 | |
| 559 | df = df[["x"]] + 10 |
| 560 | ddf = ddf[["x"]] + 10 |
| 561 | |
| 562 | |
| 563 | @gen_cluster(client=True) |
nothing calls this directly
no test coverage detected