In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to use Python to get a few rows and columns of numpy array". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "how to use Python to get a few rows and columns of numpy array"!
Foreword:
What I'm going to bring you today is Python's method of taking a few rows and columns of numpy arrays.
Direct analysis, such as the original matrix as follows (1):
(1)
The matrix we want to intercept (take one of the three rows and three or four columns of data to form a matrix) is as follows (2):
(2)
Error analysis:
Take 1 3 rows, 3 4 columns of C, define Z = [0,2] #define rows d = [2,3] #define columns #code C_zd = C[z,d]
The result is:
The analysis of the results takes the data in the first row, the third column and the fourth column of the third row, which is not the result we want.
Correct analysis:
C_A = c[[0,2]] #Take out the desired row data C_A = C_A[:,[2,3]] #Take out the required column data print(C_A) #Output the final result
The results are:
The result is what we solve for, and it takes two steps to complete.
Thank you for reading, the above is "how to use Python to get a few rows of numpy array a few columns" content, after the study of this article, I believe that everyone on how to use Python to get a few rows of numpy array a few columns this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.