numpy中一些函数方法整理
np.bincount()
numpy官方文档中解释:Count number of occurrences of each value in array of non-negative ints
统计非负数整数出现的次数。索引是从零开始的,所以bin的长度会比统计向量长度大1。
例子:

另外,bincount函数中有 weights 这个参数, 如果 weights 参数被指定,那么 np.bincount(x,weight)中 就会被加权。
例子:

1.1 = 0.7 + 1 + (-0.6)
np.array_split()
numpy 官方文档中解释:Split an array into multiple sub-arrays
例子:


浙公网安备 33010602011771号