Numpy
数组
生成数组
0开始递增, 长度为length的数组
np.arange(length)
分割数组
np.array_split(array, num_splits)
会把一个数组按顺序分成几份(近似均匀)。
合并数组
test_indices = np.concatenate((test_indices, self.indices[l:r]))
集合操作
求2个数组的并集
np.union1d(a, b)
求差集, \(a-b\) 的值
np.setdiff1d(a, b)
排列组合
数组中选择若干个的所有情况
import itertools as itt
A = [10,20,30,40,50]
list(itt.combinations(A, 2))
数组中选择2个元素的所有情况