title: Lambda function for filtering RDD in Spark(Python) - check if element not empty string
body: <p>I have the following RDD</p>
  <p><code>2019-09-24,Debt collection,transworld systems inc. is trying to collect a debt that is not mine not owed and is inaccurate.</code></p>
  <p><code>2019-09-19,Credit reporting credit repair services or other personal consumer reports,</code></p>
  <p>with each one of the 3 elements representing accordingly</p>
  <ol>
  <li>Date</li>
  <li>Label</li>
  <li>comments</li>
  </ol>
  <p>I need to apply a filter transformation in order to keep only the records that start with '201' (for the date) and include comments (they have value and are not an empty string in the third element).</p>
  <p>I am using the following code in order to calculate each time how many records have been reduced from the filtering transformations:</p>
  <p><code>countA = rdd.count()</code></p>
  <p><code>countB = rdd.filter(lambda x: x.startswith('201')).count()</code></p>
  <p><code>countC = rdd.filter(lambda x: x.startswith('201') &amp; (x.split(&quot;,&quot;)[2] != None) &amp; (len(x.split(&quot;,&quot;)[2]) &gt; 0)).count()</code></p>
  <p>my code crashes in the calculation of <code>countC</code> and although it seems as the filtering works in my further calculations I get more errors as well...
  <a href="https://i.stack.imgur.com/JKqZ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JKqZ1.png" alt="enter image description here" /></a></p>