title: python read csv file as dictionary and sort and increment a counter
body: <p>I hope someone point me in the right direction. From what I've read, I believe using a dictionary would best suit this need but I am by no means a master programmer and I hope someone can shed some light and give me a hand. This is the CSV file I have:</p>
  
  <pre><code>11362672,091914,100914,100.00,ITEM,11,N,U08
  12093169,092214,101514,25.00,ITEM,11,N,U10
  12162432,091214,101214,175.00,ITEM,11,N,U07
  11362672,091914,100914,65.00,ITEM,11,N,U08
  11362672,091914,100914,230.00,ITEM,11,N,U08
  </code></pre>
  
  <p>I would like to treat the first column a key, and the following columns as the values for that key in order to: </p>
  
  <ol>
  <li>sort the data by the key</li>
  <li>counter the occurrences</li>
  <li>append the counter</li>
  </ol>
  
  <p>This is the output I would like to attain:</p>
  
  <pre><code>1,11362672,091914,100914,100.00,ITEM,11,N,U08 # occurrence 1 for key: 11362672
  2,11362672,091914,100914,65.00,ITEM,11,N,U08 # occurrence 2 for key: 11362672
  3,11362672,091914,100914,230.00,ITEM,11,N,U08 # occurrence 3 for key: 11362672
  1,12093169,092214,101514,25.00,ITEM,11,N,U10 # occurrence 1 for key: 12093169
  1,12162432,091214,101214,175.00,ITEM,11,N,U07 # occurrence 1 for key: 12162432
  </code></pre>
  
  <p>I need to keep the integrity of each line which is why I think a dictionary will work best. I don't have much, but this is what I started with. This is where I need help to sort, counter and append the counter.</p>
  
  <pre><code>import csv
  with open('C:/Download/item_report1.csv', 'rb') as infile:
       reader = csv.reader(infile)
       dict1 = {row[0]:row[1:7] for row in reader}
       print dict1
  </code></pre>
  
  <p>gives me:</p>
  
  <pre><code>{
  '11362672': ['091914', '100914', '230.00', 'ITEM', '11', 'N'], 
  '12093169': ['092214', '101514', '25.00', 'ITEM', '11', 'N'], 
  '12162432': ['091214', '101214', '175.00', 'ITEM', '11', 'N']
  }
  </code></pre>