title: pyspark error: 'DataFrame' object has no attribute 'map'
body: <p>I am using pyspark 2.0 to create a DataFrame object by reading a csv using:</p>
  
  <pre><code>data = spark.read.csv('data.csv', header=True)
  </code></pre>
  
  <p>I find the type of the data using</p>
  
  <pre><code>type(data)
  </code></pre>
  
  <p>The result is </p>
  
  <pre><code>pyspark.sql.dataframe.DataFrame
  </code></pre>
  
  <p>I am trying to convert the some columns in data to LabeledPoint in order to apply a classification. </p>
  
  <pre><code>from pyspark.sql.types import *    
  from pyspark.sql.functions import loc
  from pyspark.mllib.regression import LabeledPoint
  
  data.select(['label','features']).
                map(lambda row:LabeledPoint(row.label, row.features))
  </code></pre>
  
  <p>I came across with this problem:</p>
  
  <pre><code>AttributeError: 'DataFrame' object has no attribute 'map'
  </code></pre>
  
  <p>Any idea on the error? Is there a way to generate a LabelPoint from DataFrame in order to perform classification?</p>