title: Filter RDD based on row_number
body: <p>sc.textFile(path) allows to read an HDFS file but it does not accept parameters (like skip a number of rows, has_headers,...). </p>
  
  <p>in the "Learning Spark" O'Reilly e-book, it's suggested to use the following function to read a CSV (Example 5-12. Python load CSV example)</p>
  
  <pre><code>import csv
  import StringIO
  
  def loadRecord(line):
  """Parse a CSV line"""
  input = StringIO.StringIO(line)
  reader = csv.DictReader(input, fieldnames=["name", "favouriteAnimal"])
  return reader.next()
  input = sc.textFile(inputFile).map(loadRecord)
  </code></pre>
  
  <p>My question is about how to be selective about the rows "taken":</p>
  
  <ol>
  <li>How to avoid loading the first row (the headers)</li>
  <li>How to remove a specific row (for instance, row 5)</li>
  </ol>
  
  <p>I see some decent solutions here: <a href="https://stackoverflow.com/questions/24677180/how-do-i-select-a-range-of-elements-in-spark-rdd">select range of elements</a> but I'd like to see if there is anything more simple.</p>
  
  <p>Thx! </p>