I have a shared DataFrame in each thread in a thread pool and I need to update it on each run of each thread(f_download
). However, in the end, I do not see any changes on DataFrame. How is possible to solve it?
from multiprocessing import Pool
import time
oo = [1,1,1,1,1,1,1,1,1,1,1,1,1]
def f(x):
time.sleep(.5)
oo[x] = 100
if __name__ == '__main__':
with Pool(5) as p:
p.map(f, [1,2,3,4,5,6,7,8,9])
print(oo)
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]