0
How to speed up python loops?
I need to interact with a list of 5000 items and the loop takes around 5 minutes to cover the list.
4 Respostas
+ 2
can we see your code?
+ 2
List comprehesions are a bit faster than loops, maybe try constructing those, instead of using regular loops.
0
Without showing your code we can only give you general answers. A thing you should consider is using PYPY which is much faster than CPython as it uses a JIT compiler:
https://pypy.org/
0
import pandas as pd
data = pd.read(SQL, cnxn)
df.pd.DataFrame(data)
for i in df:
s = df[df['Item'] == i
a = s.pivot(index='Item', columns='Date', values='Quantity')
I'm making a plot for each item and saving it into an specific folder