variable column name in dask assign() or apply()
问题 I have code that works in pandas , but I'm having trouble converting it to use dask . There is a partial solution here, but it does not allow me to use a variable as the name of the column I am creating/assigning to. Here's the working pandas code: percent_cols = ['num_unique_words', 'num_words_over_6'] def find_fraction(row, col): return row[col] / row['num_words'] for c in percent_cols: df[c] = df.apply(find_fraction, col=c, axis=1) Here's the dask code that doesn't do what I want: data =