title: Reading a specific number of lines of a .csv in python
body: <p>I have a csv file that I am trying to read into python and then I want to store the first two columns in a variable called name and gender.  The current code I am using is the following:</p>
  
  <pre><code>import csv
  infile = open('blue.csv', 'r')
  csvfile = csv.reader(infile)
  
  name = []
  gender = []
  
  for row in csvfile:
      name.append(row[0])
      gender.append(row[1])
  </code></pre>
  
  <p>There are two problems I am encountering:</p>
  
  <p>1) The csv file has headers so I don't want those included inside the variables when I store the columns</p>
  
  <p>2) I am missing the gender for the last row of the csv file and so I don't want to include the last line of the csv file when I store it in a variable.</p>
  
  <p>I am an <code>R</code> programmer and so to me, the way I would get around this is to read in the file excluding the first row and last row but I am unsure of how to do this in python, or better yet, if there is a better/smarter alternative. </p>
  
  <p>If it helps, here is what a mock dataset would look like:</p>
  
  <pre><code>Name, Gender
  Bob, Male
  Susan, Female
  Doug,
  </code></pre>