title: Python read csv file columns into lists, ignoring headers
body: <p>I have a file 'data.csv' that looks something like</p>
  
  <pre><code>ColA, ColB, ColC
  1,2,3
  4,5,6
  7,8,9
  </code></pre>
  
  <p>I want to open and read the file columns into lists, with the 1st entry of that list omitted, e.g.</p>
  
  <pre><code>dataA = [1,4,7]
  dataB = [2,5,8]
  dataC = [3,6,9]
  </code></pre>
  
  <p>In reality there are more than 3 columns and the lists are very long, this is just an example of the format. I've tried:</p>
  
  <pre><code>csv_file = open('data.csv','rb')
  csv_array = []
  
  for row in csv.reader(csv_file, delimiter=','):
      csv_array.append(row)
  </code></pre>
  
  <p>Where I would then allocate each index of <code>csv_array</code> to a list, e.g.</p>
  
  <pre><code>dataA = [int(i) for i in csv_array[0]]
  </code></pre>
  
  <p>But I'm getting errors:</p>
  
  <pre><code>_csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
  </code></pre>
  
  <p>Also it feels like a very long winded way of just saving data to a few lists...</p>
  
  <p>Thanks!</p>
  
  <p>edit:</p>
  
  <p>Here is how I solved it:</p>
  
  <pre><code>import pandas as pd
  
  df = pd.read_csv('data.csv', names = ['ColA','ColB','ColC']
  
  dataA = map(int,(df.ColA.tolist())[1:3])
  </code></pre>
  
  <p>and repeat for the rest of the columns.</p>