1.np.logspace (start,stop,num): a function representation means that geometric series num is generated between (Start,stop)
eg
as npprint np.logspace (1,4,4)
The result is: [10. 100.1000. 10000.]
2. Np.fromstring (' admin ', dtype=np.int8): The function is to replace the string with the corresponding ASCII value
as npprint np.fromstring ('admin', dtype= np.int8)
The result is: [97 100 109 105 110]
3. Customize your own data type:
Import NumPy as NP
Student = Np.dtype ({' names ': [' name ', ' age '], ' formats ': [' S32 ', ' I ']})
Print Student
Xiaoming = Np.array ([(' Gong ', ')], dtype=student)
Print Xiaoming
Print xiaoming[0][' name ']
Print xiaoming[0][' age ']
Results:
[(' Name ', ' S32 '), (' Age ', ' <i4 ')]
[(' Gong ', 12)]
Gong
12
4. Generate a one-dimensional array in a linear form:
as npprint np.linspace (0,4,6)
Results: [0. 0.8 1.6 2.4 3.2 4. ]
5. Use Frompyfun for accelerated scientific calculations
as npdef func (A, b): return A += Np.linspace (1460.61 1) print FX (x)
Results:
[1.6 2.2 2.8000000000000003 3.4 4.0 4.6]
6. Np.dot ([1,2],[2,3]) computes the inner product (matrix multiplication) of the matrix
Results: 8
7.np.inner (A, b) is the sum of the column vectors
8.np.outer (A, b) multiplies the row vectors.
NumPy of the scientific calculation of Python