title: variable column name in dask assign() or apply()
body: <p>I have code that works in <code>pandas</code>, but I'm having trouble converting it to use <code>dask</code>. There is a partial solution <a href="https://stackoverflow.com/questions/32363114/how-do-i-change-rows-and-columns-in-a-dask-dataframe">here</a>, but it does not allow me to use a variable as the name of the column I am creating/assigning to. </p>
  
  <p>Here's the working <code>pandas</code> code:</p>
  
  <pre><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)
  </code></pre>
  
  <p>Here's the <code>dask</code> code that doesn't do what I want:</p>
  
  <pre><code>data = dd.from_pandas(df, npartitions=8)
  
  for c in percent_cols:
      data = data.assign(c = data[c] / data.num_words)
  </code></pre>
  
  <p>This assigns the result to a new column called <code>c</code> rather than modifying the value of <code>data[c]</code> (what I want). Creating a new column would be fine if I could have the column name be a variable. E.g., if this worked:</p>
  
  <pre><code>for c in percent_cols:
      name = c + "new"
      data = data.assign(name = data[c] / data.num_words)
  </code></pre>
  
  <p>For obvious reasons, python doesn't allow an expression left of an <code>=</code> and ignores the previous value of <code>name</code>. </p>
  
  <p>How can I use a variable for the name of the column I am assigning to? The loop iterates far more times than I'm willing to copy/paste. </p>