Andrey Tvorothkov
Andrey Tvorothkov

Reputation: 39

Concurrent in Python 2

I have a function pre_raw() and pandas data train_raw.values in python3 I could like this:

with concurrent.futures.ThreadPoolExecutor() as executor:
     executor.map(pre_raw, train_raw.values)

How to wrote it on Python2?

Thanks.

Upvotes: 1

Views: 1206

Answers (1)

Andrey Tvorothkov
Andrey Tvorothkov

Reputation: 39

procs=[]
for val in train_raw.values:
    p = multiprocessing.Process(target=pre_raw, args=(val,))
    procs.append(p)
    p.start()

for p in procs:
    p.join()

Upvotes: 1

Related Questions