首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >peakutils.indexes提供了TypeError:只有整数标量数组才能转换为标量索引

peakutils.indexes提供了TypeError:只有整数标量数组才能转换为标量索引
EN

Stack Overflow用户
提问于 2017-04-07 08:00:31
回答 1查看 1.4K关注 0票数 2

我有一个名为self.data_的浮点数列表,我将这个列表提供给peakutils.indexes(),如下所示:

索引= peakutils.indexes(self.data_,thres=0.1,min_dist=50)

但是我得到了这个错误:

TypeError:只能将整数标量数组转换为标量索引

你觉得这是怎么回事?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2017-06-19 07:22:41

在我的例子中,我能够通过将我的数据转换为numpy数组来使其工作。最近似乎有一些变化,不能将单个标量数组视为索引数组。

通过在peak.py中编辑这段代码,我特别能够让它为我工作,大约在第34行。

代码语言:javascript
复制
    if isinstance(y, np.ndarray) and np.issubdtype(y.dtype, np.unsignedinteger):
        raise ValueError("y must be signed")
if isinstance(y, list):
        y = np.array(y)

我也有opened an issue

他的函数文档确实指定了它应该是:

代码语言:javascript
复制
y : ndarray (signed)
    1D amplitude data to search for peaks.

TypeError: only integer scalar arrays can be converted to a scalar index

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43267633

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档