# Numpy_ Array (three dots, no colon, single colon, double colon)

Source: Internet
Author: User

`ImportNumPy>>> a = Numpy.array ([[1,2,3,4,5],[6,7,8,9,10],[1,2,3,4,5],[6,7,8,9,10]])>>>Aarray ([[1, 2, 3, 4, 5],       [ 6, 7, 8, 9, 10],       [ 1, 2, 3, 4, 5],       [ 6, 7, 8, 9, 10]])>>> a[...,2]array ([3, 8, 3, 8])>>> A[...,:2]array ([[1, 2],       [6, 7],       [1, 2],       [6, 7]])>>> A[...,::2]array ([[1, 3, 5],       [ 6, 8, 10],       [ 1, 3, 5],       [ 6, 8, 10]])>>> A[...,:3]array ([[1, 2, 3],       [6, 7, 8],       [1, 2, 3],       [6, 7, 8]])>>> A[...,::3]array ([[1, 4],       [6, 9],       [1, 4],       [6, 9]])`

a[...,2]: ... Represents the traversal of each row, with 2 representing the column with the index 2.

A[...,:2]: ... Represents a traversal of each row, and: 2 represents the column where 0,1 is indexed as <2.

A[...,::2]: ... Indicates that each row is traversed, 2 is the step, and the 0,2,4 is selected as the multi-index column.

Numpy_ Array (three dots, no colon, single colon, double colon)

Related Keywords:

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.