Multiprocessing using on multiple for loops - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Multiprocessing using on multiple for loops (/thread-20090.html) |
Multiprocessing using on multiple for loops - Staph - Jul-27-2019 AS5_all = [] n= 500 for i in range n: for x in range(len(lat)): for y in range(len(lon)): lst = np.array((AS[:, x, y])) rs = resample(lst) rs_all[:, x, y] = rs AS5 = AS1.rolling(time=59).reduce(np.nanpercentile, q=5) AS5_all.append(AS5) RE: Multiprocessing using on multiple for loops - micseydel - Jul-27-2019 Did you have a question? RE: Multiprocessing using on multiple for loops - Staph - Jul-28-2019 Yes sorry it didnt get typed. I wanted to ask how I can use multiprocessing to speed up this code in python? RE: Multiprocessing using on multiple for loops - ThomasL - Jul-28-2019 Maybe if you specify a little bit more detailed what you want to achieve with that code snippet and the wider meaning of what you are working on. 3 nested for loops is likely a slow process and as you are already working with numpy there maybe a function/method in numpy/scipy/sympy that does the same but 1000 times faster. |