One of the gripes of Python and pandas users is that the ease of use and expressiveness of the language and module comes with a significant downside—the performance. This happens especially when it comes to numeric computing.
According to programming benchmark standards, Python is often slower than compiled languages, such as C/C++, for many algorithms or data structure operations. An example of this would be binary-tree operations. In one simulation experiment, Python3 ran 104 times slower than the fastest C++ implementation of an n-body simulation calculation.
So, how can we solve this legitimate, yet vexing problem? We can mitigate this slowness in Python while maintaining the things that we like—clarity and productivity. This can be done by writing the parts of our code that are performance-sensitive-for example,...