How to map a column with dask
<p>I want to apply a mapping on a DataFrame column. With Pandas this is straight forward:</p>

<pre><code>df["infos"] = df2["numbers"].map(lambda nr: custom_map(nr, hashmap))
</code></pre>

<p>This writes the <code>infos</code> column, based on the <code>custom_map</code> function, and uses the rows in numbers for the <code>lambda</code> statement.</p>

<p>With <a href="http://dask.pydata.org/en/latest/dataframe-api.html" rel="noreferrer">dask</a> this isn't that simple. <code>ddf</code> is a dask DataFrame. <code>map_partitions</code> is the equivalent to parallel execution of the mapping on a part of the DataFrame.</p>

<p>This does <strong>not</strong> work because you don't define columns like that in dask.</p>

<pre><code>ddf["infos"] = ddf2["numbers"].map_partitions(lambda nr: custom_map(nr, hashmap))
</code></pre>

<p>Does anyone know how I can use columns here? I don't understand their <a href="http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.DataFrame.map_partitions" rel="noreferrer">API documentation</a> at all. </p>