There are many programming pitfalls in Python that can make for slow execution.
Loops, for example. While Pandas is generally good, using the apply() method basically
means you are using loops.
Dramatic speedups can be made by manipulating Numpy arrays and exploiting list comprehension.
For instance, I achieved 400x speedup on Pandas code by reformulating the mathematical model,
translating to Numpy arrays and applying clever stride techniques.
Such speedups often rely on techniques that are discovered using highly skilled Google searches!
Alan King
AI & Blockchain, Finance
IBM Research