indexes and slices for numpy
The contents of the Ndarray object can be viewed and modified through indexing and tiling.
Index: An element index in an Ndarray object based on 0
Slice: A description of a region of a fragment in an array
The slices of an array can also be understood as a partial view of the original array, all pointing to the original array in memory, so the changes on the slices are reflected directly on the original array, unlike the list copy .
Example code for an indexed tile demonstrates:
NumPy Code demos for common functions:
NumPy substitution function transpose, T, and swapaxes presentation and distinction
T applies to one or two-D arrays
arr = Np.arange (a). Reshape (3,4) #生成一个3行4列的数组
Print (arr) print (arr. T
Transpose is understood to be the operation of the data shape property and the conversion, the instance code is as follows
Swapaxes received parameters are a pair of axis numbers for axis swap operations
NumPy Matrix arithmetic function This one's not going to be a demo. Interested to know
(Additional numpy will be appended to the next step as an extension article)
Filed under: Lego Ai_python (i):Pandas basic Knowledge
Lego Ai_python (b): NumPy index, slice, common function