Skip to content

Commit

Permalink
Mark to_dataframe as not working
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Jan 25, 2025
1 parent 2b86d10 commit 50ef61d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/dask_awkward/lib/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from dask.local import identity
from dask.utils import funcname, is_integer, parse_bytes
from fsspec.utils import infer_compression
from packaging.version import parse as parse_version

from dask_awkward.layers.layers import (
AwkwardBlockwiseLayer,
Expand All @@ -42,7 +43,7 @@
if TYPE_CHECKING:
from dask.array.core import Array as DaskArray
from dask.bag.core import Bag as DaskBag
from dask.dataframe.core import DataFrame as DaskDataFrame
from dask.dataframe import DataFrame as DaskDataFrame
from dask.delayed import Delayed
from fsspec.spec import AbstractFileSystem

Expand Down Expand Up @@ -466,9 +467,14 @@ def to_dataframe(
"""
import dask
from dask.dataframe.core import DataFrame as DaskDataFrame
from dask.dataframe.core import new_dd_object
from dask.dataframe import DataFrame as DaskDataFrame
from dask.dataframe import new_dd_object # type: ignore

if parse_version(dask.__version__) >= parse_version("2025"):
raise NotImplementedError(
"to_dataframe is broken with dask 2025.1.0"
"either wait for a fix, or downgrade your dask."
)
if optimize_graph:
(array,) = dask.optimize(array)
intermediate = map_partitions(
Expand Down
9 changes: 9 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dask.delayed import delayed
from fsspec.core import get_fs_token_paths
from numpy.typing import DTypeLike
from packaging.version import parse as parse_version

import dask_awkward as dak
from dask_awkward.lib.core import typetracer_array
Expand Down Expand Up @@ -246,6 +247,10 @@ def test_to_bag(daa, caa):
assert comprec.tolist() == entry.tolist()


@pytest.mark.skipif(
parse_version(dask.__version__) >= parse_version("2025"),
reason="dask.DataFrame constructor changed",
)
@pytest.mark.parametrize("optimize_graph", [True, False])
def test_to_dataframe(daa: dak.Array, caa: ak.Array, optimize_graph: bool) -> None:
pytest.importorskip("pandas")
Expand All @@ -261,6 +266,10 @@ def test_to_dataframe(daa: dak.Array, caa: ak.Array, optimize_graph: bool) -> No
assert_eq(dd, df, check_index=False)


@pytest.mark.skipif(
parse_version(dask.__version__) >= parse_version("2025"),
reason="dask.DataFrame constructor changed",
)
@pytest.mark.parametrize("optimize_graph", [True, False])
def test_to_dataframe_str(
daa_str: dak.Array, caa_str: ak.Array, optimize_graph: bool
Expand Down

0 comments on commit 50ef61d

Please sign in to comment.