numpy linspace意外步骤值

时间:2019-03-01 13:54:28

标签: python numpy

为什么以下代码不会导致TreeNode treeNode = columnTree.getData().find("EmployeeId", 264); columnTree.selectRecord(treeNode); ?我想这与浮点精度有关,但是如何以“正确的”方式做到呢?

step=0.1

以上结果将显示以下输出:

import numpy as np

lastprice = 3779

binsize = 0.1
minbin = round(lastprice*0.25, 0) - binsize/2
maxbin = round(lastprice/0.25, 0) + binsize/2
bincount = int((maxbin-minbin) / binsize)

bins, steps = np.linspace(minbin, maxbin, num=bincount, retstep=True, endpoint=False)


print(minbin)    
print(maxbin)
print(round((maxbin-minbin),0))
print(bincount)
print(steps)
print(bins)

0 个答案:

没有答案