title: Filter out non digit values in pyspark RDD
body: <p>I have an RDD which looks like this:</p>
  <pre><code>[[&quot;3331/587&quot;,&quot;Metro&quot;,&quot;1235&quot;,&quot;1000&quot;],
  [&quot;1234/232&quot;,&quot;City&quot;,&quot;8479&quot;,&quot;2000&quot;],
  [&quot;5987/215&quot;,&quot;Metro&quot;,&quot;1111&quot;,&quot;Unkown&quot;],
  [&quot;8794/215&quot;,&quot;Metro&quot;,&quot;1112&quot;,&quot;1000&quot;],
  [&quot;1254/951&quot;,&quot;City&quot;,&quot;6598&quot;,&quot;XXXX&quot;],
  [&quot;1584/951&quot;,&quot;City&quot;,&quot;1548&quot;,&quot;Unkown&quot;],
  [&quot;1833/331&quot;,&quot;Metro&quot;,&quot;1009&quot;,&quot;2000&quot;],
  [&quot;2213/987&quot;,&quot;City&quot;,&quot;1197&quot;, ]]
  </code></pre>
  <p>I want to calculate the average and max of the last values of each row (1000, 2000 etc) for each distinct value in the second entries (City/Metro) separately. I am using the the following code to collect &quot;City&quot; values:</p>
  <pre><code>rdd.filter(lambda row: row[1] == 'City').map(lambda x: float(x[3])).collect()
  </code></pre>
  <p>However, I get error, probably because of the string values (&quot;Unkown&quot; e.g.) in the series.</p>
  <p>How can I filter out rows with string and null values (=keep only those convertable to digits), and then calculate max and average?</p>