Python Forum
Multiprocessing using on multiple for loops
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiprocessing using on multiple for loops
#1
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)
Reply
#2
Did you have a question?
Reply
#3
Yes sorry it didnt get typed. I wanted to ask how I can use multiprocessing to speed up this code in python?
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiprocessing Pool Multiple Instances How to Kill by Pool ID sunny9495 0 766 Nov-16-2022, 05:57 AM
Last Post: sunny9495
  Multiple loops Paulman 4 1,871 Oct-11-2021, 08:25 AM
Last Post: Paulman
  Multiple for loops selenium webdriver KRS 4 2,595 Mar-10-2020, 03:31 PM
Last Post: KRS

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020