title: sort csv column based on value of specific column with defaultdict in python
body: <p>How could I sort a column in a csv file the way that excel will sort. below is my csv file and snippet code that I have so far. I want to sort ArrivalTime, so the particular Process and ServiceTime move along. Thank for any help or advice.</p>
  
  <p>csv:</p>
  
  <pre><code>    Process,ArrivalTime,ServiceTime
      A,0,3
      B,2,6
      C,4,4
      D,6,5
      E,8,2
  </code></pre>
  
  <p>and my code:</p>
  
  <pre><code> import csv
   from collections import defaultdict
  
      columns = defaultdict(list)
      with open('file.csv') as f:
        reader = csv.DictReader(f) 
        for row in reader:        
          for (k,v) in row.items(): 
            columns[k].append(v)
  
  st = columns['ServiceTime']
  at = columns['ArrivalTime']
  pr = columns['Process']
  </code></pre>