I'd like to speed up the execution time of my function in python. I read that a good way to do this is using a Bisection or Hashtable method. Do you know how I can do this with this function?
from time import time
import csv
f = open('file.csv')
reader = csv.reader(f, delimiter=';')
def old(abi):
first = True
for row in reader:
if first:
first = False
first_row = row
else:
if row[0] == abi:
res = row
res = dict(zip(first_row, res))
break
@timing
def test2():
for x in xrange(3000, 800000):
old(str(x))
test2()
Thank you very much for help me ;)