Convert Pandas dataframe to Dask dataframe
<p>Suppose I have pandas dataframe as:</p>

<pre><code>df=pd.DataFrame({'a':[1,2,3],'b':[4,5,6]})
</code></pre>

<p>When I convert it into dask dataframe what should <code>name</code> and <code>divisions</code> parameter consist of:</p>

<pre><code>from dask import dataframe as dd 
sd=dd.DataFrame(df.to_dict(),divisions=1,meta=pd.DataFrame(columns=df.columns,index=df.index))
</code></pre>

<blockquote>
  <p>TypeError: <strong>init</strong>() missing 1 required positional argument: 'name'</p>
</blockquote>

<p><strong>Edit</strong> :
Suppose I create a pandas dataframe like:</p>

<pre><code>pd.DataFrame({'a':[1,2,3],'b':[4,5,6]})
</code></pre>

<p>Similarly how to create dask dataframe as it needs three additional arguments as <code>name,divisions</code> and <code>meta</code>.</p>

<pre><code>sd=dd.Dataframe({'a':[1,2,3],'b':[4,5,6]},name=,meta=,divisions=)
</code></pre>

<p>Thank you for your reply.</p>

<p>I think you can use <a href="http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.from_pandas" rel="nofollow"><code>dask.dataframe.from_pandas</code></a>:</p>

<pre><code>from dask import dataframe as dd 
sd = dd.from_pandas(df, npartitions=3)
print (sd)
dd.DataFrame&lt;from_pa..., npartitions=2, divisions=(0, 1, 2)&gt;
</code></pre>

<p>EDIT:</p>

<p>I find <a href="https://github.com/dask/dask/blob/57285aa1cd721f0845b4f2b3756cb82d5f4597cf/dask/dataframe/tests/test_categorical.py#L14" rel="nofollow">solution</a>:</p>

<pre><code>import pandas as pd
import dask.dataframe as dd
from dask.dataframe.utils import make_meta

df=pd.DataFrame({'a':[1,2,3],'b':[4,5,6]})

dsk = {('x', 0): df}

meta = make_meta({'a': 'i8', 'b': 'i8'}, index=pd.Index([], 'i8'))
d = dd.DataFrame(dsk, name='x', meta=meta, divisions=[0, 1, 2])
print (d)
dd.DataFrame&lt;x, npartitions=2, divisions=(0, 1, 2)&gt;
</code></pre>

python pandas dataframe data-conversion dask