title: How do I get a subset of a csv file as a Spark RDD
body: <p>I am new to Spark and am trying to read a csv file and get the first and second column in the file. The thing though is that the csv file is huge and I am not interested in parsing each and every line in the csv file. Also, running the collect() function might crash the process because the memory might not be enough to support the amount of data being returned. So I was wondering if it is possible to create a RDD with only a subset of the csv data. For example, is it possible to generate a RDD containing lines 10 to 1000 of the csv file and ignore the other lines.</p>
  
  <p>Right now, all I have is</p>
  
  <pre><code>csvdata = sc.textFile("hdfs://nn:port/datasets/sample.csv").map(lambda line: line.split(","))
  </code></pre>
  
  <p>This basically creates a RDD for the entire csv file. Is it possible to create a RDD from csvdata containing lines 10 to 1000 only?</p>
  
  <p>Thanks a lot for the help offered.</p>