 <p>This works:</p> <pre><code>data={} with open(fn) as f: reader=csv.reader(f, delimiter='\t', quoting=csv.QUOTE_NONE) header=next(reader) for row in reader: data.setdefault(row[1], []).append(int(row[2])) print 'key\tmin\tmax' for k in data.keys(): print '{}\t{}\t{}'.format(k, min(data[k]), max(data[k])) </code></pre> <p>With your example data, prints:</p> <pre><code>key min max bye 2 7 hi 1 5 </code></pre>