title: how to convert my pyspark code into scala?
body: <p>I am a scala beginner. Now I have to convert some codes I wrote in Pyspark to scala. The codes are just to extract fields for modeling. 
  Could someone point out to me how to write the following code into scala? At least where and how I could get the quick answer. Thanks so much!!!</p>
  
  <p>Here are my previous codes</p>
  
  <pre><code>{val records = rawdata.map(x=&gt; x.split(","))
  
  val data = records.map(r=&gt; LabeledPoint(extract_label(r), extract_features(r)))
  </code></pre>
  
  <p>...</p>
  
  <pre><code>def extract_features(record):
      return np.array(map(float, record[2:16]))
  
  
  def extract_label(record):
      return float(record[16])
  }
  </code></pre>