1. Shape () function
- In the
numpy module
- Input parameters: Similar arrays (such as lists, tuples), or arrays
- Returns the tuple of an integer number in which each element in the tuple represents the length of each dimension of the corresponding array
# shape[0]返回对象的行数,shape[1]返回对象的列数= dataSet.shape[0]#一维列表 L=range(5) shape(L) #输出(5, )#二维列表 L=[[1,2,3],[4,5,6]] shape(L) #输出(2,3) 即两行三列
2. Tile () function
- Return
array
tile(A,reps)ACopy the reps secondary
tile(x,(n,m))xconstruct a n row m column matrix with
3. SUM () function
sum(a,axis=0)For the common sum
- A.sum (Axis=1) adds
a the vector of each line of the matrix
4. Argsort () function
x.argsort(), the elements in X are sorted from small to large
- The returned is not a sorted x, but rather a sequence of ordered elements in the X subscript.
importas npx=np.array([1,4,3,-1,6,9])y=x.argsort() #y的值为[3,0,2,1,4,5]
Python Common computational function usage