3 ms·
There are a couple of things wrong with this article. The first problem, as pointed out by apl and em500, is the non-idiomatic pandas code. Pandas is fast not
by aleyan 9y ago
There are a couple of things wrong with this article.
The first problem, as pointed out by apl and em500, is the non-idiomatic pandas code. Pandas is fast not when you rewrite your algorithms using one for one with pandas functions, but when you use functions provided uniquely by pandas, then you start thinking with pandas. My rewrite[0] with groupby is 47 times faster than pure python; it would be 1848 times faster if I didn't convert the result to list of lists from DataFrame as in the other cases.
Secondly, if your analysis is taking too long on your MacBook Air, you should switch up to faster hardware before investing your time in time consuming optimizations. Presumably this is work done for an employer and for them the data scientists time is much more expensive than a powerful AWS instance. Of course if you made big Big O mistakes, no amount of hardware is going to fix that.
[0] https://github.com/aleyan/machinelearningexp/blob/master/DataScience_Performance_Python_Pandas_Numpy.ipynb https://github.com/aleyan/machinelearningexp/blob/master/Dat...