1. 数组的集合运算 1.1. 并集 np.union1d(a,b)计算数组的并集: In [1]: import numpy as np In [2]: a = np.array([1,2,3]) In [3]: b = np.array([3,4,5]) In [4]: np.union1d(a,b) Out[4]: array([1, 2, 3, 4, 5]) 1.2. 交集 np.intersect1d(a,b)计算数组的交集: In [10]: import numpy as np I…
import numpy as np #int16和int32内存少,int64内存大但精度高 a = np.array([1,23,4],dtype=np.int32) b = np.zeros((3,4),dtype=np.int16) c = np.arange(10,20,2) #定义一个三行四列的 d = np.arange(12).reshape((3,4)) e = np.linspace(1,10,20) #1和10分20段的数列 g = np.linspace(1,10,6).…