变形
- numpy.ndarray.shape表示数组的维度,返回一个元组,这个元组的长度就是维度的数目,即 ndim 属性(秩)
- numpy.ndarray.flat 将数组转换为一维的迭代器,可以用for访问数组每一个元素。
- numpy.ndarray.flatten([order=‘C’]) 将数组的副本转换为一维数组,并返回。
转置
- numpy.transpose(a, axes=None) Permute the dimensions of an array.
- numpy.ndarray.T Same as self.transpose(), except that self is returned if self.ndim < 2.
维度
- numpy.newaxis = None None的别名,对索引数组很有用。
- numpy.squeeze(a, axis=None) 从数组的形状中删除单维度条目,即把shape中为1的维度去掉。
组合
- numpy.concatenate((a1, a2, …), axis=0, out=None) Join a sequence of arrays along an existing axis.
- numpy.stack(arrays, axis=0, out=None)Join a sequence of arrays along a new axis.
- numpy.vstack(tup)Stack arrays in sequence vertically (row wise).
- numpy.hstack(tup)Stack arrays in sequence horizontally (column wise).
拆分
- numpy.split(ary, indices_or_sections, axis=0) Split an array into multiple sub-arrays as views into ary.
- numpy.vsplit(ary, indices_or_sections) Split an array into multiple sub-arrays vertically (row-wise).
- numpy.hsplit(ary, indices_or_sections) Split an array into multiple sub-arrays horizontally (column-wise).
平铺
- numpy.tile(A, reps) Construct an array by repeating A the number of times given by reps.
- numpy.repeat(a, repeats, axis=None) Repeat elements of an array.
增删
- numpy.unique(ar, return_index=False, return_inverse=False,return_counts=False, axis=None) Find the unique elements of an array.