title: issue in writing data from 2 RDDs (one with unicode data and one with normal )into a csv file in PySpark?
body: <p>I have two <code>RDD's</code>:</p>
  
  <p><strong>RDD1:</strong> data in <code>RDD1</code> is in unicode format</p>
  
  <pre><code>[[u'a',u'b',u'c'],[u'c',u'f',u'a'],[u'ab',u'cd',u'gh']...]
  </code></pre>
  
  <p><strong>RDD2:</strong></p>
  
  <pre><code>[(10.1, 10.0), (23.0, 34.0), (45.0, 23.0),....]
  </code></pre>
  
  <p>Both the <code>RDDs</code> have same number of rows (but one has 2 columns/elements in each row/record and one has 3). Now what I want to do is take all elements from <code>RDD2</code> and <code>2nd</code> record from <code>RDD1</code> and write them out to a <code>csv</code> file <strong>on the local file system (not hdfs)</strong>. So the output in the <code>csv</code> file for above sample will be:</p>
  
  <pre><code>a,b,c,10.0
  c,f,a,34.0
  ab,cd,gh,23.0
  </code></pre>
  
  <p>How can I do that in <code>PySpark</code>?</p>
  
  <p><strong>UPDATE:</strong> This is my current code:</p>
  
  <pre><code>columns_num = [0,1,2,4,7]
  rdd1 = rdd3.map(lambda row: [row[i] for i in columns_num])
  
  rdd2 = rd.map(lambda tup: (tup[0], tup[1]+ (tup[0]/3)) if tup[0] - tup[1] &gt;= tup[0]/3 else (tup[0],tup[1]))
  
  with open("output.csv", "w") as fw:
      writer = csv.writer(fw)
      for (r1, r2) in izip(rdd1.toLocalIterator(), rdd2.toLocalIterator()):
          writer.writerow(r1 + tuple(r2[1:2]))
  </code></pre>
  
  <p>I am getting error as <code>TypeError: can only concatenate list (not "tuple") to list</code>. If I do <code>writer.writerow(tuple(r1) + r2[1:2])</code> then I get error as <code>UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 16: ordinal not in range(128)</code>
  `</p>