更新时间:2022-06-13 07:54:10
鉴于其名称,我认为标准方法应为delete
:
Given its name, I think the standard way should be delete
:
import numpy as np
A = np.delete(A, 1, 0) # delete second row of A
B = np.delete(B, 2, 0) # delete third row of B
C = np.delete(C, 1, 1) # delete second column of C
根据 numpy的文档页面,numpy.delete
的参数如下:
numpy.delete(arr, obj, axis=None)
arr
引用输入数组obj
指的是哪些子数组(例如列/行号或数组的切片)和axis
是指按列(axis = 1
)或按行(axis = 0
)删除操作.arr
refers to the input array, obj
refers to which sub-arrays (e.g. column/row no. or slice of the array) andaxis
refers to either column wise (axis = 1
) or row-wise (axis = 0
) delete operation.