- Python Data Analysis(Second Edition)
- Armando Fandango
- 237字
- 2021-07-09 19:04:03
NumPy arrays
After going through the installation of NumPy, it's time to have a look at NumPy arrays. NumPy arrays are more efficient than Python lists when it comes to numerical operations. NumPy arrays are, in fact, specialized objects with extensive optimizations. NumPy code requires less explicit loops than equivalent Python code. This is based on vectorization.
If we go back to high school mathematics, then we should remember the concepts of scalars and vectors. The number 2, for instance, is a scalar. When we add 2 to 2, we are performing scalar addition. We can form a vector out of a group of scalars. In Python programming terms, we will then have a one-dimensional array. This concept can, of course, be extended to higher dimensions. Performing an operation on two arrays, such as addition, can be reduced to a group of scalar operations. In straight Python, we will do that with loops going through each element in the first array and adding it to the corresponding element in the second array. However, this is more verbose than the way it is done in mathematics. In mathematics, we treat the addition of two vectors as a single operation. That's the way NumPy arrays do it too, and there are certain optimizations using low-level C routines that make these basic operations more efficient. We will cover NumPy arrays in more detail in the Chapter 2, NumPy Arrays.
- ExtGWT Rich Internet Application Cookbook
- 數據庫原理及應用(Access版)第3版
- SOA實踐
- Go語言高效編程:原理、可觀測性與優化
- Visual Basic編程:從基礎到實踐(第2版)
- Mastering Spring MVC 4
- x86匯編語言:從實模式到保護模式(第2版)
- PhoneGap:Beginner's Guide(Third Edition)
- PySide 6/PyQt 6快速開發與實戰
- Mastering Git
- Python從入門到精通
- Raspberry Pi Robotic Projects(Third Edition)
- Clean Code in C#
- Android應用開發實戰
- Three.js Essentials