python/ray/data/read_api.py
def from_dask(df: "dask.DataFrame") -> Dataset[ArrowRow]:
    """Create a dataset from a Dask DataFrame.

    Args:
        df: A Dask DataFrame.

    Returns:
        Dataset holding Arrow records read from the DataFrame.
    """
    import dask
    from ray.util.dask import ray_dask_get

    partitions = df.to_delayed()
    persisted_partitions = dask.persist(*partitions, scheduler=ray_dask_get)

    import pandas

    def to_ref(df):
        if isinstance(df, pandas.DataFrame):
            return ray.put(df)
        elif isinstance(df, ray.ObjectRef):
            return df
        else:
            raise ValueError(
                "Expected a Ray object ref or a Pandas DataFrame, " f"got {type(df)}"
            )

    return from_pandas_refs(
        [to_ref(next(iter(part.dask.values()))) for part in persisted_partitions]
    )
Create a dataset from a Dask DataFrame.

    Args:
        df: A Dask DataFrame.

    Returns:
        Dataset holding Arrow records read from the DataFrame.
    
Create a dataset from a Dask DataFrame.
Create a dataset from a Dask DataFrame .
def from_dask(df: "dask.DataFrame") -> Dataset[ArrowRow]:
    import dask
    from ray.util.dask import ray_dask_get
    partitions = df.to_delayed()
    persisted_partitions = dask.persist(*partitions, scheduler=ray_dask_get)
    import pandas
    def to_ref(df):
        if isinstance(df, pandas.DataFrame):
            return ray.put(df)
        elif isinstance(df, ray.ObjectRef):
            return df
        else:
            raise ValueError(
                "Expected a Ray object ref or a Pandas DataFrame, " f"got {type(df)}"
            )
    return from_pandas_refs(
        [to_ref(next(iter(part.dask.values()))) for part in persisted_partitions]
    )
def from_dask ( df : "dask.DataFrame" ) -> Dataset [ ArrowRow ] : import dask from ray . util . dask import ray_dask_get partitions = df . to_delayed ( ) persisted_partitions = dask . persist ( * partitions , scheduler = ray_dask_get ) import pandas def to_ref ( df ) : if isinstance ( df , pandas . DataFrame ) : return ray . put ( df ) elif isinstance ( df , ray . ObjectRef ) : return df else : raise ValueError ( "Expected a Ray object ref or a Pandas DataFrame, " f"got {type(df)}" ) return from_pandas_refs ( [ to_ref ( next ( iter ( part . dask . values ( ) ) ) ) for part in persisted_partitions ] )
Create a dataset from a Dask DataFrame.
Create a dataset from a Dask DataFrame .
"""Create a dataset from a Dask DataFrame.

    Args:
        df: A Dask DataFrame.

    Returns:
        Dataset holding Arrow records read from the DataFrame.
    """
Dataset holding Arrow records read from the DataFrame.
Dataset holding Arrow records read from the DataFrame .
df
"dask.DataFrame"
A Dask DataFrame.
A Dask DataFrame .