简体   繁体   中英

Computing time in Python [Python for Data Analysis 3E]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM