Numpy:np.bincount()的用法1. np.bincount(x)2. np.bincount(x,weights=w)3.np.bincount(x,weights=w,minlength=7)
1. np.bincount(x)x = np.array([1, 2, 3, 3, 0, 9, 4])np.bincount(x)输出:array([1, 1, 1, 2, 1, 0, 0, 0, 0, 1], dtype=int64)统计数值出现次数:数值0出现1次,1出现1次,2出现1次,3出现2次,4出现1次,5-8出现0次,9出现1次。2. np.bincount(x,weights=w)x = np.array([1, 2, 3, 3, 0, 9, 4])w = np.arra