title: Extract particular column from CSV file in scala (Spark)
body: <p>I have csv file like:</p>
  
  <p><a href="https://i.stack.imgur.com/LfZAR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LfZAR.jpg" alt="enter image description here"></a></p>
  
  <p>I want to extract only the column "Summary" out of the above file.</p>
  
  <p>I wrote code:</p>
  
  <pre><code>val read_file2 = sc.textFile("/home/hari/sample_data_exp/extract_column_only.csv") 
  read_file2.collect()
  
  val tmp1 = read_file2.map { line =&gt; val parts = line.split(',')
  parts.drop(3).take(1)
  </code></pre>
  
  <p>But this giving output as :</p>
  
  <p><a href="https://i.stack.imgur.com/VCXzs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VCXzs.jpg" alt="enter image description here"></a></p>
  
  <p>Many "Array()" is coming. I want only the values of that column "Summary", no blank arrays in between.</p>