Getting the value of a DataFrame column in Spark : <p>I am trying to retrieve the value of a DataFrame column and store it in a variable. I tried this :</p>

<pre><code>val name=df.select("name")
 val name1=name.collect()
</code></pre>

<p>But none of the above is returning the value of column "name".</p>

<p>Spark version :2.2.0
Scala version :2.11.11</p>
