首页 > 解决方案 > 如何控制python中bin的大小以使用numpy.histogram

问题描述

我尝试使用 numpy 包控制 bin,如下代码

bin_hights, bin_width = np.histogram(get_pdf,density=True)

有什么方法可以控制 bin 大小以使用 numpy 包?

标签: pythonnumpyhistogram

解决方案


我使用以下方法解决了这个问题:

numpy.histogram(a, bins=15)
numpy.histogram(a, bins=10, range=None, normed=None, weights=None, density=None)

https://numpy.org/doc/stable/reference/generated/numpy.histogram.html


推荐阅读