How to append to a Dask Dataframe

Thank you very much for your help.
Assuming that the point with the duplicates you have mentioned is not a problem and that the results can fit in a pandas Dataframe but the input Dataframe should be a Dask Dataframe, is there anything that I could do to make the computation of duplicates faster?

In the previous code snippet combinations and distincts can fit in memory, and ddf is a dask dataframe.
This loop runs very slow when running in dask distributed environment. Is there any way to make this for loop run in parallel using Dask?