Repository: dask/dask

Issue:
dask.dataframe.from_dask_array doc wrong
I'm aware that documentation may be wrong (from https://github.com/dask/dask/issues/2450), but I've just found what can be another typo. As I didn't find anywhere talking about it, I'm opening this issue for reference.

I was looking for a way to get a Dask Array from a Dask DataFrame, then I came across this.

Doc about [dask.dataframe.from_dask_array](http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.from_dask_array) is weird.

```
Create Dask Array from a Dask DataFrame

Converts a 2d array into a DataFrame and a 1d array into a Series.

    Parameters:
        x: da.Array
        columns: list or string
            list of column names if DataFrame, single string if Series

Examples

>>> import dask.array as da
>>> import dask.dataframe as dd
>>> x = da.ones((4, 2), chunks=(2, 2))
>>> df = dd.io.from_dask_array(x, columns=['a', 'b'])
>>> df.compute()
     a    b
0  1.0  1.0
1  1.0  1.0
2  1.0  1.0
3  1.0  1.0
```

Actually, this should be about "Create **Dask DataFrame** from a **Dask Array**", right?


Discussion:
Yes, I think that you are correct

On Wed, Jun 14, 2017 at 4:00 PM, Paulo Haddad <notifications@github.com>
wrote:

> I'm aware that documentation may be wrong (from #2450
> <https://github.com/dask/dask/issues/2450>), but I've just found what can
> be another typo. As I didn't find anywhere talking about it, I'm opening
> this issue for reference.
>
> Doc about dask.dataframe.from_dask_array
> <http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.from_dask_array>
> is weird.
>
> Create Dask Array from a Dask DataFrame
>
> Converts a 2d array into a DataFrame and a 1d array into a Series.
>
>     Parameters:
>         x: da.Array
>         columns: list or string
>             list of column names if DataFrame, single string if Series
>
> Examples
>
> >>> import dask.array as da
> >>> import dask.dataframe as dd
> >>> x = da.ones((4, 2), chunks=(2, 2))
> >>> df = dd.io.from_dask_array(x, columns=['a', 'b'])
> >>> df.compute()
>      a    b
> 0  1.0  1.0
> 1  1.0  1.0
> 2  1.0  1.0
> 3  1.0  1.0
>
> Actually, this should be about "Create *Dask DataFrame* from a *Dask
> Array*", right?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/dask/dask/issues/2455>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASszCDM5MLscxtqQnRmdpOfxPO5ssGaks5sEDvqgaJpZM4N6Xp2>
> .
>

Just went through what I was looking for (and proof by contradiction)

http://dask.pydata.org/en/latest/array-creation.html#from-dask-dataframe

```
You can create dask arrays from dask dataframes using the .values attribute or the .to_records() method.

>>> x = df.values
>>> x = df.to_records()
```

Resolving patch:
diff --git a/dask/dataframe/io/io.py b/dask/dataframe/io/io.py
--- a/dask/dataframe/io/io.py
+++ b/dask/dataframe/io/io.py
@@ -343,7 +343,7 @@ def dataframe_from_ctable(x, slc, columns=None, categories=None, lock=lock):
 
 
 def from_dask_array(x, columns=None):
-    """ Create Dask Array from a Dask DataFrame
+    """ Create a Dask DataFrame from a Dask Array.
 
     Converts a 2d array into a DataFrame and a 1d array into a Series.
 


Test patch: