We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
numpy.bincount(x, weights=None, minlength=0)
x
weights
minlength
shape
Output
上例中 minlength 可以设置 大于 80 的值,小于无效
import numpy as np data = np.array([1,1,1,1,1,1,2,3,5,4,4,4,5,80]) np.bincount(data.astype(np.int8))
array([0, 6, 1, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
max value
np.bincount(data.astype(np.int8), minlength=90)
array([0, 6, 1, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
np.bincount(img.flatten())
The text was updated successfully, but these errors were encountered:
#17
Sorry, something went wrong.
No branches or pull requests
numpy 统计数组数值
x
需要是一维数组 + 非负整数weights
每个位置的权重,维度同x
minlength
输出最小shape
Output
最大值为 80, 输出[0,1,2....,80] 的统计值UseCase
max value
Reference
The text was updated successfully, but these errors were encountered: