I have a loop that takes 21 minutes to run because of for loop. It is not complicated loop but I need to iterate all that many times.
My code looks like this
results=[]
for i in range(len(files)) ### around 5000 files with 96 rows each that evaluates
results_f= function(arg1[i], arg2)
results= results.append(results_f)
So how can I make that with multi threading?
I have tried something like
with concurrent.futures.ThreadPoolExecutor() as executor:
for i in range(len(files)):
results = executor.map(function, [arg1[i],arg2])
that I saw working somewhere but it is not working at all
arg1with an index valid forfiles. Further, "not working at all" is not a problem description. Please try out any actual example code that works and then adapt it to your case. If that causes problems, be specific! At the moment, your Q could be summarized "please teach me multithreading", which is not a valid topic here.