This article mainly introduces the deletion of the numpy in the delete array of the entire row and column, has a certain reference value, now share to everyone, the need for friends can refer to
NumPy Delete is the whole row and column of the array can be deleted, and the following is a brief description of the delete function usage:
Numpy.delete (arr, obj, Axis=none)
Parameters:
ARR: input Array
Obj: Slice, integer, indicating which sub-array to be removed
Axis: Delete the axis of a sub-array
Axis = 0: The row that deletes the array
Axis = 1: A column that deletes an array
Axis = None: Indicates that the array is tiled by one-dimensional array for index deletion
Return: A new sub-array
x = Array ([[[1,2,3],[4,5,6],[7,8,9]])
1. Delete line I and multiline operations
x = Numpy.delete (x,i, axis = 0)
To delete a multiline operation:
2. Delete Column I or multi-column operations
x = Numpy.delete (x,i, axis = 1)
To delete a multi-column operation:
3.axis = None operation
The above is the entire content of this article, more relevant content please pay attention to topic.alibabacloud.com.