ValueError: RDD is empty-- Pyspark (Windows Standalone)
<p>I am trying to create an RDD but spark not creating it, throwing back error, pasted below;</p>

<pre><code>data = records.map(lambda r: LabeledPoint(extract_label(r), extract_features(r)))
first_point = data.first()

Py4JJavaError                             Traceback (most recent call last)
&lt;ipython-input-19-d713906000f8&gt; in &lt;module&gt;()
----&gt; 1 first_point = data.first()
  2 print "Raw data: " + str(first[2:])
  3 print "Label: " + str(first_point.label)
  4 print "Linear Model feature vector:\n" + str(first_point.features)
  5 print "Linear Model feature vector length: " + str(len    (first_point.features))

C:\spark\python\pyspark\rdd.pyc in first(self)
1313         ValueError: RDD is empty
1314         """
-&gt; 1315         rs = self.take(1)
1316         if rs:
1317             return rs[0]

C:\spark\python\pyspark\rdd.pyc in take(self, num)
 1295 
 1296             p = range(partsScanned, min(partsScanned + numPartsToTry, totalParts))
-&gt; 1297             res = self.context.runJob(self, takeUpToNumLeft, p)..................
</code></pre>

<p>Any help will be greatly appreciated. </p>

<p>Thank you,
Innocent </p>

<p>Your <code>records</code> is empty. You could verify by calling <code>records.first()</code>.</p>

<p>Calling <code>first</code> on an empty RDD raises error, but not <code>collect</code>. For example,</p>

<pre><code>records = sc.parallelize([])

records.map(lambda x: x).collect()
</code></pre>

<blockquote>
  <p>[]</p>
</blockquote>

<pre><code>records.map(lambda x: x).first()
</code></pre>

<blockquote>
  <p>ValueError: RDD is empty</p>
</blockquote>

python pyspark rdd