title: Duplicate Count on key column CSV file python 3
body: <p>I am having the delimited file.(CSV/PIPE delimited file)</p>
  
  <p><strong>Sample File:</strong></p>
  
  <pre><code>Id,Name,Age
  1,ads,23
  2,dfg,24
  2,hgh,25
  3,fgh,26
  4,fdfgh,27
  4,fh,28
  </code></pre>
  
  <p>I have to get the <strong>duplicate count</strong> on the column <strong>Id</strong> and also separate file (duplicates) should be created. Both the duplicate count and also file with duplicates should be created.</p>
  
  <p>Output should look like</p>
  
  <p><strong>Console:</strong> it should print like</p>
  
  <pre><code>ID : 
  2 is repeated 2 times
  4 is repeated 2 times
  </code></pre>
  
  <p><strong>output file</strong> Should look like </p>
  
  <pre><code>ID:
  2 is repeated 2 times 
  4 is repeated 2 times
  </code></pre>
  
  <p>Here is my sample code.</p>
  
  <pre><code>import sys
  import csv
  import datetime
  import time
  import os from operator
  import itemgetter from collections
  import Counter
  
  d = ','
  read1 = csv.reader(open('D:\ANACONDS\example.csv','r'),delimiter=d)
  sort_src = sorted(read1, key=itemgetter(0))
  g = len(list(csv.reader(open('D:\ANACONDS\example.csv'))))
  print("the number of records are :" ,g)
  ids = Counter()
  for row in sort_src:
      ids += Counter([row[0]])
      print(len(list(ids)))
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>