Python Forum

Full Version: Multiprocessing using on multiple for loops
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
Did you have a question?
Yes sorry it didnt get typed. I wanted to ask how I can use multiprocessing to speed up this code in python?
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.