import numpy as np
x=np.arange(3,23)#产生一个3-22的一维数组
# x=np.arange(x,y,step)从x到y每隔step大小的元素组合成的一维数组
x=x.reshape(4,5)#把这个一维矩阵转换为二维矩阵
x=x.reshape(4,5).T#array().T把矩阵转置
# x[1][1]=5
# x=np.unique(x)#把矩阵里的数目变成一个不重复的一维矩阵
y=x[:,1]#x[start:end,index]切片,取从start到end行每行索引为index的元素
z=x.max()#直接取矩阵里的最大元素,对应的还有min()函数
numpy_1(arrange,reshape,unique,切片)
最新推荐文章于 2021-03-29 10:57:35 发布