Delete in NumPy deletes an array of entire rows and columns

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.