首页 > 其他 > 详细

Why NumPy is so important?

时间:2020-01-30 21:48:03      阅读:67      评论:0      收藏:0      [点我收藏+]

原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12243889.html

 

NumPy

One of the reasons NumPy is so important for numerical computations in Python is because it is designed for efficiency on large arrays of data.

There are a number of reasons for this:

  • NumPy internally stores data in a contiguous block of memory, independent of other built-in Python objects. NumPy’s library of algorithms written in the C language can operate on this memory without any type checking or other overhead. NumPy arrays also use much less memory than built-in Python sequences.
  • NumPy operations perform complex computations on entire arrays without the need for Python for loops.

e.g.

技术分享图片

 

Conclusion

NumPy-based algorithms are generally 10 to 100 times faster (or more) than their pure Python counterparts and use significantly less memory.

 

Reference

Python for Data Analysis Second Edition

 

Why NumPy is so important?

原文:https://www.cnblogs.com/agilestyle/p/12243889.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!