title: python csv to dictionary columnwise
body: <p>Is it possible to read data from a csv file into a dictionary, such that the first row of a column is the key and the remaining rows of that same column constitute the value as a list?</p>
  
  <p>E.g. I have a csv file</p>
  
  <pre><code>     strings, numbers, colors 
       string1, 1, blue
       string2, 2, red
       string3, 3, green
       string4, 4, yellow
  </code></pre>
  
  <p>using</p>
  
  <pre><code>with open(file,'rU') as f: 
      reader = csv.DictReader(f)
      for row in reader:
          print row
  </code></pre>
  
  <p>I obtain </p>
  
  <pre><code>{'color': 'blue', 'string': 'string1', 'number': '1'}
  {'color': 'red', 'string': 'string2', 'number': '2'}
  {'color': 'green', 'string': 'string3', 'number': '3'}
  {'color': 'yellow', 'string': 'string4', 'number': '4'}
  </code></pre>
  
  <p>or using </p>
  
  <pre><code> with open(file,'rU') as f: 
          reader = csv.reader(f)
          mydict = {rows[0]:rows[1:] for rows in reader}
          print(mydict)
  </code></pre>
  
  <p>I obtain the following dictionary</p>
  
  <pre><code>{'string3': ['3', 'green'], 'string4': ['4', 'yellow'], 'string2': ['2', 'red'], 'string': ['number', 'color'], 'string1': ['1', 'blue']}
  </code></pre>
  
  <p>However, I would like to obtain</p>
  
  <pre><code>{'strings': ['string1', 'string2', 'string3', 'string4'], 'numbers': [1, 2, 3,4], 'colors': ['red', 'blue', 'green', 'yellow']}
  </code></pre>