title: how to extract a column of CSV file in scala spark rdd
body: <p>suppose these are my CSV file:</p>
  
  <pre><code>21628000000;21650466094
  21697098269;21653506459
  21653000000;21624124815
  21624124815;21650466094
  21650466094;21650466094
  21624124815;21697098269
  21697098269;21628206459
  21628000000;21624124815
  21650466094;21628206459
  21628000000;21628206459
  </code></pre>
  
  <p>I want to count the number of occurrences in the first column to have a result:</p>
  
  <pre><code>(21628000000,4)
  (21697098269,2)
  (21624124815,2)
  (21650466094,2)
  </code></pre>
  
  <p>i've tried:</p>
  
  <pre><code>object CountOcc {
    def main(args: Array[String]) {
      val conf = new SparkConf()
      .setAppName("Word Count")
      .setMaster("local")
  
      val sc = new SparkContext(conf)
  
      //loading text file into textFile object .(RDD)
      val textFile = sc.textFile(args(0))
  
     //read the line , split the line into words
      val words = textFile.flatMap (line =&gt; line.split(";"))
      val cols = words.map(_.trim)
      println(s"${cols(0)}") //error
      cols.foreach(println)
     sc.stop()
  
    }
  }
  </code></pre>
  
  <p>I get an error  <strong>org.apache.spark.rdd.RDD error [String] Does not take parameters</strong></p>
  
  <p>So I can't make cols(0) or cols(1),how I can have only the first column so I can calculate the occurrence?</p>