docs/source/guides/dask.ipynb
If you want to try out this notebook with a live Python kernel, use mybinder:
<a class="reference external image-reference" href="https://mybinder.org/v2/gh/vaexio/vaex/latest?filepath=docs%2Fsource%2Fexample_dask.ipynb"></a>
A vaex dataframe can be lazily converted to a dask.array using DataFrame.to_dask_array.
import vaex
df = vaex.example()
df
# convert a set of columns in the dataframe to a 2d dask array
A = df[['x', 'y', 'z']].to_dask_array()
A
import dask.array as da
# lazily compute with dask
r = da.sqrt(A[:,0]**2 + A[:,1]**2 + A[:,2]**2)
r
# materialize the data
r_computed = r.compute()
r_computed
# put it back in the dataframe
df['r'] = r_computed
df