title: Make .csv files from arrays in Scala
body: <p>I have two tuples in Scala of the following form:</p>
  
  <pre><code>val array1 = (bucket1, Seq((dateA, Amount11), (dateB, Amount12), (dateC, Amount13))) 
  val array2 = (bucket2, Seq((dateA, Amount21), (dateB, Amount22), (dateC, Amount23)))
  </code></pre>
  
  <p>What is the quickest way to make a <code>.csv</code> file in Scala such that:</p>
  
  <ol>
  <li><code>date*</code> is pivot.</li>
  <li><code>bucket*</code> is column name.</li>
  <li><code>Amount*</code> fill the table.</li>
  </ol>
  
  <p>It needs to look something like this:</p>
  
  <p>Dates______________bucket1__________bucket2</p>
  
  <p>dateA______________Amount11________Amount21</p>
  
  <p>dateB______________Amount12________Amount22</p>
  
  <p>dateC______________Amount13________Amount23</p>