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