title: PySpark: TypeError: 'Row' object does not support item assignment
body: <p>I used the following code to replace the <code>None</code> value in a DataFrame row to an empty string:</p>
  
  <pre><code>def replaceNone(row):
    row_len = len(row)
    for i in range(0, row_len):
      if row[i] is None:
        row[i] = ""    
    return row
  </code></pre>
  
  <p>in my pyspark code:</p>
  
  <pre><code>data_out = df.rdd.map(lambda row : replaceNone(row)).map(
    lambda row : "\t".join( [x.encode("utf-8") if isinstance(x, basestring) else str(x).encode("utf-8") for x in row])
  )
  </code></pre>
  
  <p>Then I got the following errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>File "&lt;ipython-input-10-8e5d8b2c3a7f&gt;", line 1, in &lt;lambda&gt;
    File "&lt;ipython-input-2-d1153a537442&gt;", line 6, in replaceNone
  TypeError: 'Row' object does not support item assignment
  </code></pre>
  
  <p>Does anyone have any idea about the error? How do I replace a "None" value in a row to an empty string? Thanks!</p>