nump学习笔记(2)

23.[A1,A2.A3]=np.split(A,[1,3],axis=1)将矩阵A在水平方向上切割,0列给A1,第1列到第2列给A2,第3列给A3。

     [A1,A2.A3]=np.split(A,[1,3],axis=0)将矩阵A在垂直方向上切割,0行给A1,第1行到第2行给A2,第3行给A3。

24.If youwant to generate a complete and distinct array, use the copy() function.

 c=a.copy()#此时,c不再是指向a指向的地方,c与a指向内存中两个地方,改变a对c没有影响,改变c对a也没有影响。即赋值只是浅拷贝,用此函数才是深拷贝。

25.broadcasting

26.保存array:np.save("path+name",data);获取array:np.load("path+name")

     读取tabular data(txt,csv):data=np.genfromtxt("path_name",delimiter="separates character",names=True/False(whether the data contain column headers))

posted @ 2019-10-25 15:51  Turing-dz  阅读(139)  评论(0编辑  收藏  举报