加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python:使用numpy.histogram

发布时间:2020-12-20 11:14:39 所属栏目:Python 来源:网络整理
导读:我正在使用这个: http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html 我有一个我想要使用的列表,如下所示: numpy.histogram(a,bins=[0.1,0.2,0.3,0.4...6],range=[0:6]) 我如何在0.1个间隔中包含一组0.1到6的区间? 我如何指定0到
我正在使用这个:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html

我有一个我想要使用的列表,如下所示:

numpy.histogram(a,bins=[0.1,0.2,0.3,0.4...6],range=[0:6])

>我如何在0.1个间隔中包含一组0.1到6的区间?
>我如何指定0到6的范围?

解决方法

也许你正在寻找np.linspace(0,6,num = 61)或np.arange(0,6.1,0.1):

import numpy as np
a=np.random.random(100)*6
hist=np.histogram(a,bins=np.linspace(0,num=61))

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读