本文整理匯總了Python中numpy.lib.histograms.histogram_bin_edges方法的典型用法代碼示例。如果您正苦於以下問題:Python histograms.histogram_bin_edges方法的具體用法?Python histograms.histogram_bin_edges怎麽用?Python histograms.histogram_bin_edges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.lib.histograms
的用法示例。
在下文中一共展示了histograms.histogram_bin_edges方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_limited_variance
# 需要導入模塊: from numpy.lib import histograms [as 別名]
# 或者: from numpy.lib.histograms import histogram_bin_edges [as 別名]
def test_limited_variance(self):
"""
Check when IQR is 0, but variance exists, we return the sturges value
and not the fd value.
"""
lim_var_data = np.ones(1000)
lim_var_data[:3] = 0
lim_var_data[-4:] = 100
edges_auto = histogram_bin_edges(lim_var_data, 'auto')
assert_equal(edges_auto, np.linspace(0, 100, 12))
edges_fd = histogram_bin_edges(lim_var_data, 'fd')
assert_equal(edges_fd, np.array([0, 100]))
edges_sturges = histogram_bin_edges(lim_var_data, 'sturges')
assert_equal(edges_sturges, np.linspace(0, 100, 12))
示例2: test_histogram_bin_edges
# 需要導入模塊: from numpy.lib import histograms [as 別名]
# 或者: from numpy.lib.histograms import histogram_bin_edges [as 別名]
def test_histogram_bin_edges(self):
hist, e = histogram([1, 2, 3, 4], [1, 2])
edges = histogram_bin_edges([1, 2, 3, 4], [1, 2])
assert_array_equal(edges, e)
arr = np.array([0., 0., 0., 1., 2., 3., 3., 4., 5.])
hist, e = histogram(arr, bins=30, range=(-0.5, 5))
edges = histogram_bin_edges(arr, bins=30, range=(-0.5, 5))
assert_array_equal(edges, e)
hist, e = histogram(arr, bins='auto', range=(0, 1))
edges = histogram_bin_edges(arr, bins='auto', range=(0, 1))
assert_array_equal(edges, e)