title: Apache Spark how to append new column from list/array to Spark dataframe
body: <p>I am using Apache Spark 2.0 Dataframe/Dataset API
  I want to add a new column to my dataframe from List of values. My list has same number of values like given dataframe. </p>
  
  <pre><code>val list = List(4,5,10,7,2)
  val df   = List("a","b","c","d","e").toDF("row1")
  </code></pre>
  
  <p>I would like to do something like:</p>
  
  <pre><code>val appendedDF = df.withColumn("row2",somefunc(list))
  df.show()
  // +----+------+
  // |row1 |row2 |
  // +----+------+
  // |a    |4    |
  // |b    |5    |
  // |c    |10   |
  // |d    |7    |
  // |e    |2    |
  // +----+------+
  </code></pre>
  
  <p>For any ideas I would be greatful, my dataframe in reality contains more columns.</p>