title: How to write dataframe with duplicate column name into a csv file in pyspark
body: <p>How can i write a dataframe having same column name after join operation into a csv file. Currently i am using the following code. <code>dfFinal.coalesce(1).write.format('com.databricks.spark.csv').save('/home/user/output/',header = 'true')</code>which will write the dataframe "dfFinal" in "/home/user/output".But it is not working in situaton that the dataframe contains a duplicate column. Below is the dfFinal dataframe.</p>
  
  <pre><code>+----------+---+-----------------+---+-----------------+
  |  NUMBER  | ID|AMOUNT           | ID|           AMOUNT|
  +----------+---+-----------------+---+-----------------+
  |9090909092|  1|               30|  1|               40|
  |9090909093|  2|               30|  2|               50|
  |9090909090|  3|               30|  3|               60|
  |9090909094|  4|               30|  4|               70|
  +----------+---+-----------------+---+-----------------+
  </code></pre>
  
  <p>The above dataframe is formed after a join operation. When writing to a csv file it is giving me the following error.</p>
  
  <pre><code>pyspark.sql.utils.AnalysisException: u'Found duplicate column(s) when inserting into file:/home/user/output: `amount`, `id`;'
  </code></pre>