Beginner NumPy (Fri)

Source: Internet
Author: User
Tags pprint

Array Transpose and Axisymmetric

Transpose (transpose) is a special form of remodeling that returns a view of the source data and does not do any copy operations, and the array has not only the Transpose method, but also a special T attribute.

(1) Transpose

(2) T

(3) Swapaxes

1 Import NumPy as NP 2  from Import Pprint 3 arr =  np.arange (All). Reshape ((3,5))4pprint (arr)5  Pprint (arr. T)6pprint (Arr.transpose ())7 pprint (arr.swapaxes (0,1))

Operation Result:

1Array ([[[0, 1, 2, 3, 4],2[5, 6, 7, 8, 9],3[10, 11, 12, 13, 14]])4Array ([[[0, 5, 10],5[1, 6, 11],6[2, 7, 12],7[3, 8, 13],8[4, 9, 14]])9Array ([[[0, 5, 10],Ten[1, 6, 11], One[2, 7, 12], A[3, 8, 13], -[4, 9, 14]]) -Array ([[[0, 5, 10], the[1, 6, 11], -[2, 7, 12], -[3, 8, 13], -[4, 9, 14]])

Beginner NumPy (Fri)

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.