title: spark save dataframe to multiple csv files
body: <p>This question has a partial answer here : <a href="https://stackoverflow.com/questions/23995040/write-to-multiple-outputs-by-key-spark-one-spark-job/37150604#37150604">Write to multiple outputs by key Spark - one Spark job</a></p>
  
  <p>But i want to save a Dataframe to multiple csv files.</p>
  
  <pre><code>df =  sqlContext.createDataFrame([Row(name=u'name1', website=u'http://1', url=u'1'),
   Row(name=u'name2', website=u'http://1', url=u'1'),
   Row(name=u'name3', website=u'https://fsadf', url=u'2'),
   Row(name=u'name4', website=None, url=u'3')])
  
  df.write.format('com.databricks.spark.csv').partitionBy("name").save("dataset.csv")
  </code></pre>
  
  <p>And i'm using spark-csv (<a href="https://github.com/databricks/spark-csv" rel="nofollow noreferrer">https://github.com/databricks/spark-csv</a>) to handle csv data.</p>
  
  <p>One more thing, <code>df.write.partitionBy("column").json("dataset")</code> , saves data to multiple directories like <code>column=value1, column=value2</code> etc , but the column itself is not present in the data.</p>
  
  <p>what if i need that column in the output dataset ?? </p>