The NumPy section functions as follows:
- Ndarray, a fast space-saving multidimensional array with vector operators and complex broadcast capabilities
- Standard mathematical function for fast operation of array data
- Tools for reading and writing disk data and tools for manipulating memory-mapped files
- Linear algebra, random number generation and Fourier transform functions
- Tools for inheriting code written in C, C + +, Fortran, and other languages
One of the most important features of NumPy is its n-dimensional array object (Ndarray), which is a fast and flexible large data set container. This array object can be used to perform some mathematical operations on the entire block of data, with the same syntax as the scalar operation.
in [5]: Import NumPy asNpin [6]: Data=np.array ([[0.9526,-0.246,-0.8856],[0.5639,0.2379,0.9104]]) in [7]: dataout[7]:array ([[0.9526, -0.246, -0.8856], [ 0.5639,0.2379,0.9104]]) in [8]: Data *Tenout[8]:array ([[9.526, -2.46, -8.856], [ 5.639,2.379,9.104]]) in [9]: Data +dataout[9]:array ([[1.9052, -0.492, -1.7712], [ 1.1278,0.4758,1.8208]])
Ndarray is a generic homogeneous data multidimensional container in which all elements must be of the same type. Each array has a shape (a tuple that represents a dimension size) and a dtype (an object that describes the array data type)
in [ in]: Test_data=np.array ([[1,2,3],[4,5,6],[7,8,9]]) in [ -]: dataout[ -]:array ([[0.9526, -0.246, -0.8856], [ 0.5639,0.2379,0.9104]]) in [ to]: test_dataout[ to]:array ([[1,2,3], [4,5,6], [7,8,9]]) in [ +]: data.shapeout[ +]: (2,3) #表示2行3列In [ -]: test_data.shapeout[ -]: (3,3) #表示3行3列
In [the]: data.dtypeout[: Dtype ('float64') in [ * ]: test_data.dtypeout[: Dtype ('int32')
Create Ndarry
The simplest way to create an array is to use the array function. It accepts all sequences of objects (including other arrays) and then produces a new NumPy array of incoming data.
Python--numpy Study (i)