1.np.linspace(a,b,n):从a到b均匀取n个点
2.np.meshgrid(x,y):
使用方法:
这是用于制作坐标矩阵,就是以坐标为元素的矩阵
x方向的可取范围即是x矩阵中的元素
y方向的可取范围即是y矩阵中的元素
注意,得到的两个矩阵的size,以下面那个为例,都是 6*5
import numpy as np
X,Y=np.meshgrid(np.linspace(1,5,5),np.linspace(1,6,6))
print(X)
print('__'*50)
print(Y)
import numpy as np
import matplotlib.pyplot as plt
A = np.array([2, 1])
B=np.array([5,8,9,0])
X,Y=np.meshgrid(A,B)
print(X)
print('-'*50)
print('B')
print('-'*50)
plt.plot(X,Y,'o--')
plt.grid(True) #这个表示显示网络线格
plt.show()
3.np.insert()
4.np.dot()
5.np.piecewise()
这么理解后两个,不同的分支以及满足条件的对应操作
6.np.argsort()
用来排序,从小到大排序并返回对应的索引
如使用【::-1】可变成从大到小的排序
7.np.ravel()
与np.flatten()所要实现的功能都是将多维数组降位一维,区别在于
np.flatten()返回一份拷贝,对拷贝所做的修改不会影响(reflects)原始矩阵
numpy.ravel()返回的是视图(view,也颇有几分C/C++引用reference的意味),会影响(reflects)原始矩阵。
8.np.column_stack()
左右并起来
import numpy as np
import matplotlib.pyplot as plt
#grid_X,grid_y都是50*50
grid_x,grid_y=np.meshgrid(np.linspace(1,6,50),np.random.randint(0,2,50))
mesh_x=np.column_stack((grid_x.ravel(),grid_y.ravel()))
print(mesh_x)
reference:
https://blog.csdn.net/lllxxq141592654/article/details/81532855
https://blog.csdn.net/weixin_45860697/article/details/103270244
https://blog.csdn.net/skywalker1996/article/details/82462499?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162891088416780255274790%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=162891088416780255274790&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_v2~rank_v29-1-82462499.pc_search_result_cache&utm_term=np.dot&spm=1018.2226.3001.4187
https://blog.csdn.net/weixin_46348799/article/details/108963151
https://blog.csdn.net/maoersong/article/details/21875705
https://blog.csdn.net/lanchunhui/article/details/50354978