** array: ** a concept in computer, representing a way of organizing and storing data. Its elements can be numbers or characters

The transpose operation of array is borrowed from the transpose operation of matrix in linear algebra. Swap rows with columns, i.e. the first row becomes the first column… Or the first column becomes the first row… Operation even transpose operation.

##1. Transpose of multidimensional arrays

Import numpy as NP test = Np. array([[12,4,7,0],[3,7,45,81]]) test # array([[12,4,7,0],[3,7,45, Transpose () # array([[12, 3], [4, 7], [7, 45], [0, 81]])Copy the code

##2. Transpose a one-dimensional array

Test = np.array([12,4,7,0]) test.shape # test.shape Transpose () # array([12, 4, 7, 0]) test.shape # array([12, 4, 7, 0])Copy the code

So if YOU take the transpose of a one-dimensional column vector, you’re going to get the same one-dimensional column vector, nothing’s going to happen. As a matter of practice, this should be done with the shape property. See below for details:

Result. Shape =(1,4) result # array([[12, 4, 7, 0]])Copy the code

The output result is a one-dimensional array with one row and four columns.

👏👏👏 take a look at our previous article 😃😃😃 🌺 Excel data analysis tool library – correlation coefficient 🌺 dry goods, hand in hand to teach you to do correlation analysis 🌺 5 years of data analysis road, summary. 🌺 user segmentation and portrait analysis 🌺 K-nearest neighbor algorithm and practice

Welcome to our wechat official account.Home of data analysts

Scan the QR code to follow us

💁 provides career planning, resume guidance, interview counseling services

QQ communication group: 254674155