title: PySpark: Many features to Labeled Point RDD
body: <p>New to Spark, and all examples I have read deal with small sets of data such as:</p>
  
  <pre><code>RDD = sc.parallelize([
  LabeledPoint(1, [1.0, 2.0, 3.0]),
  LabeledPoint(2, [3.0, 4.0, 5.0]),
  </code></pre>
  
  <p>However, I have a large dataset with 50+ features. </p>
  
  <p>Example of a row</p>
  
  <pre><code>u'2596,51,3,258,0,510,221,232,148,6279,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,5'
  </code></pre>
  
  <p>I want to quick create a Labeledpoint RDD in PySpark. I attempt to index the last position as my first data point in the Labeledpoint RDD, and then index the first n-1 positions as a dense vector. However I get the following error. Any guidance is appreciated! Note: if I change [] to () when creating the labeled point, I get the error "Invalid Syntax".</p>
  
  <pre><code>    df = myDataRDD.map(lambda line: line.split(','))
  data = [
       LabeledPoint(df[54], df[0:53])
  ]
  TypeError: 'PipelinedRDD' object does not support indexing
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-67-fa1b56e8441e&gt; in &lt;module&gt;()
        2 df = myDataRDD.map(lambda line: line.split(','))
        3 data = [
  ----&gt; 4      LabeledPoint(df[54], df[0:53])
        5 ]
  
  TypeError: 'PipelinedRDD' object does not support indexing
  </code></pre>