In Chapter 4 of Python for Data Analysis 3E , it shows the following example and claims that numpy should be much faster.
However, when I tried it myself, I got very different results as circled below where numpy actually takes longer time. Could anyone help clarify what the author means in the book, please?
You should read the actual results, not what you circled. NumPy was faster, 0.9 ms vs 55.6 ms. The benchmark for NumPy took longer because it repeated 100x more often (1000 loops instead of 10 loops).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.