数组处理程序 
基本操作 
| 方法 | 描述 | 
|---|---|
| copyto(dst, src[, casting, where]) | 将值从一个数组复制到另一个数组,并根据需要进行广播。 | 
改变数组形状 
| 方法 | 描述 | 
|---|---|
| reshape(a, newshape[, order]) | 在不更改数据的情况下为数组赋予新的形状。 | 
| ravel(a[, order]) | 返回一个连续的扁平数组。 | 
| ndarray.flat | 数组上的一维迭代器。 | 
| ndarray.flatten([order]) | 返回折叠成一维的数组副本。 | 
类转置操作 
| 方法 | 描述 | 
|---|---|
| moveaxis(a, source, destination) | 将数组的轴移到新位置。 | 
| rollaxis(a, axis[, start]) | 向后滚动指定的轴,直到其位于给定的位置。 | 
| swapaxes(a, axis1, axis2) | 互换数组的两个轴。 | 
| ndarray.T | 转置数组。 | 
| transpose(a[, axes]) | 排列数组的尺寸。 | 
更改维度数 
| 方法 | 描述 | 
|---|---|
| atleast_1d(*arys) | 将输入转换为至少一维的数组。 | 
| atleast_2d(*arys) | 将输入视为至少具有二维的数组。 | 
| atleast_3d(*arys) | 以至少三个维度的数组形式查看输入。 | 
| broadcast | 产生模仿广播的对象。 | 
| broadcast_to(array, shape[, subok]) | 将数组广播为新形状。 | 
| broadcast_arrays(*args, **kwargs) | 互相广播任意数量的阵列。 | 
| expand_dims(a, axis) | 扩展数组的形状。 | 
| squeeze(a[, axis]) | 从数组形状中删除一维条目。 | 
改变数组的种类 
| 方法 | 描述 | 
|---|---|
| asarray(a[, dtype, order]) | 将输入转换为数组。 | 
| asanyarray(a[, dtype, order]) | 将输入转换为ndarray,但通过ndarray子类。 | 
| asmatrix(data[, dtype]) | 将输入解释为矩阵。 | 
| asfarray(a[, dtype]) | 返回转换为浮点类型的数组。 | 
| asfortranarray(a[, dtype]) | 返回以Fortran顺序排列在内存中的数组(ndim> = 1)。 | 
| ascontiguousarray(a[, dtype]) | 返回内存中的连续数组(ndim> = 1)(C顺序)。 | 
| asarray_chkfinite(a[, dtype, order]) | 将输入转换为数组,检查NaN或Infs。 | 
| asscalar(a) | 将大小为1的数组转换为其等效的标量。 | 
| require(a[, dtype, requirements]) | 返回提供的类型满足要求的ndarray。 | 
组合数组 
| 方法 | 描述 | 
|---|---|
| concatenate((a1, a2, …) | 沿现有轴连接一系列数组。 | 
| stack(arrays[, axis, out]) | 沿新轴连接一系列数组。 | 
| column_stack(tup) | 将一维数组作为列堆叠到二维数组中。 | 
| dstack(tup) | 沿深度方向(沿第三轴)按顺序堆叠数组。 | 
| hstack(tup) | 水平(按列)顺序堆叠数组。 | 
| vstack(tup) | 垂直(行)按顺序堆叠数组。 | 
| block(arrays) | 从块的嵌套列表中组装一个nd数组。 | 
拆分数组 
| 方法 | 描述 | 
|---|---|
| split(ary, indices_or_sections[, axis]) | 将数组拆分为多个子数组,作为ary的视图。 | 
| array_split(ary, indices_or_sections[, axis]) | 将一个数组拆分为多个子数组。 | 
| dsplit(ary, indices_or_sections) | 沿第3轴(深度)将数组拆分为多个子数组。 | 
| hsplit(ary, indices_or_sections) | 水平(按列)将一个数组拆分为多个子数组。 | 
| vsplit(ary, indices_or_sections) | 垂直(行)将数组拆分为多个子数组。 | 
平铺数组 
| 方法 | 描述 | 
|---|---|
| tile(A, reps) | 通过重复A代表次数来构造一个数组。 | 
| repeat(a, repeats[, axis]) | 重复数组的元素。 | 
添加和删除元素 
| 方法 | 描述 | 
|---|---|
| delete(arr, obj[, axis]) | 返回一个新的数组,该数组具有沿删除的轴的子数组。 | 
| insert(arr, obj, values[, axis]) | 沿给定轴在给定索引之前插入值。 | 
| append(arr, values[, axis]) | 将值附加到数组的末尾。 | 
| resize(a, new_shape) | 返回具有指定形状的新数组。 | 
| trim_zeross(filt[, trim]) | 修剪一维数组或序列中的前导和/或尾随零。 | 
| unique(ar[, return_index, return_inverse, …]) | 查找数组的唯一元素。 | 
重新排列元素 
| 方法 | 描述 | 
|---|---|
| flip(m[, axis]) | 沿给定轴颠倒数组中元素的顺序。 | 
| fliplr(m) | 左右翻转数组。 | 
| flipud(m) | 上下翻转阵列。 | 
| reshape(a, newshape[, order]) | 在不更改数据的情况下为数组赋予新的形状。 | 
| roll(a, shift[, axis]) | 沿给定轴滚动数组元素。 | 
| rot90(m[, k, axes]) | 在轴指定的平面中将阵列旋转90度。 | 
