I want to use two Dask DataFrame to process large csv files, and I need to do a groupby(...).apply(...).reset_index() on one DataFrame before joining it with the other:
import pandas as pd
import dask.dataframe as dd
dfA = pd.DataFrame({'x': ["x1", "x2", "x2", "x1", "x3", "x2"],
'y': ["A", "B", "C", "B", "D", "E"]})
ddfA = dd.from_pandas(dfA, npartitions=2)
gA = ddfA.groupby('x').y.apply(list, meta=('y', 'str')).reset_index()
dfB = pd.DataFrame({'x': ["x1", "x2", "x3"],
'z': ["U", "V", "W"]})
ddfB = dd.from_pandas(dfB, npartitions=2)
gA.merge(ddfB, how='left', on='x')
Unfortunately, I have a keyError : 'x'. Can anyone help me to solve this problem?