Da
Array: A fast and flexible homogeneous multidimensional data set container that can be used to perform some mathematical operations on the entire block of data
- Data pointers, part of system memory
- DataType Data Type/dtype
- Tuple that indicates the size of the data
- Stride:strides holds the number of bytes added to the pointer in the data store when the subscript for each axis increases by 1 o'clock
- In [6]: Np.ones ((3,4,5), Dtype=np.float64). Strides
OUT[6]: (160, 40, 8)
Ndarray Data structure:
Reshape () function-1 parameter, the content of the dimension is automatically populated by the original content
C Vesu Fortran Order:
- : Row Order
- Fortran Order:column Order
The Ndarray of NumPy is the row order, and the reshape () and Ravel () functions accept a parameter for c/f conversion
Array refactoring
More Concise array refactoring: C_, R_c
Array Duplication/replication
Repeat: Repeats each element in an array for a specific number of times, and you can specify the number of repetitions for each element
Tile: Repeat recovery on the specified axis
Take and Put
Remove a specific element from an array
broadcasting/Broadcast
Spreads along the x-axis and spreads along the y-axis with subtle differences
Np.newaxis () Add new axis
Advanced Ufunc Usage
Ufunc is the abbreviation for universal function, which is a function that can operate on each element of an array, numpy many of the Ufunc functions are implemented at the C level, so they are computationally fast
- Np.add.reduce: Add and operate
- Np.add.accumulate: Similar to reduce, returns the same shape as the input array, saving all intermediate calculation results
- Np.multiply.outer:element-wise dot Product
user-defined functions
Frompyfunc
Structured and Record Arrays
Use Dtype to create structured tabular data, similar to the structure in C
NumPy sort
Argsort:
Lexsort: multiple sort
searchsorted
- Finds the elements in the sorted array, returns the position where the lookup value should be inserted in the array, which can make the array still orderly
- can also be used to find the position of an element within a certain interval
Speed performance:
Cpython
[Reading notes] Python Data Analysis (12) Advanced NumPy