Python---numpy module

Source: Internet
Author: User

1.NumPy is a basic module of Python scientific Computing. NumPy not only accomplishes the task of scientific computing, but also can be used as an effective multidimensional data container for storing and processing large matrices.

2. In performance, NumPy is much more efficient than Python's own nested list structure!!

3.NumPy multiple ways to create an array:

Arr1=np.array ([1,2,3]) Print ARR1ARR2=np.array ([(1.5,2,8.4),(2,9,8.6)]) print ARR2ARR3=np.identity (3,int) #生成3维的单位矩阵print ARR3ARR4=np.zeros ((3,4),int) #生成3行4列零矩阵print Arr4print""generates a random matrix of 2 rows and 3 columns for each element in the" 0,1 ""ARR5=np.random.random ((2,3)) Print ARR5

Results:

[1 2 3][[ 1.5  2.8.4] [ 2.9.8.6]][[1 0 0] [0 1 0] [0 0 1]][[0 0 0 0] [0 0 0 0] [0 0 0 0]] "generates 2 rows 3 columns Each element is in the"0,1"The random matrix between [[0.75387207  0.42818932  0.39820343] [ 0.13796389  0.10722287  0.87060598]]

Python---numpy module

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.