1000000 69.301998615264894 сек.
memory usage: 297.9 MB
import csv
from collections import defaultdict
import time
from memory_profiler import memory_usage
result = defaultdict(int)
st = time.time()
with open('test.csv') as f:
reader = csv.DictReader(f)
counter = 0
for row in reader:
full_address_tuple =(row["Postcode"],)
result[full_address_tuple] += 1
if counter == 10 ** 6:
break
counter += 1
print(f"{counter} {time.time() - st} ceк.", sep='',end='\r')
print(f"\n\n{memory_usage()} MB")
enJRDv