我如何在Python中找到峰?我得到索引。我想要价值
from scipy.signal import find_peaks
a=[2,3,4,1]
b=find_peaks(a)
print(b)
我得到了索引。但是我想要价值观。如何获得列表的值?
from scipy.signal import find_peaks
a=[2,3,4,1]
b=find_peaks(a)
print(b)
I am getting the indices. But I want the values. How can I get the values of the list?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用原始矢量上的索引来返回峰值的值:
You can use the indices on the original vector to return the value of the peak like this:
最简单的方法是将
a
转换为numpy数组,然后将其索引。The easiest way is to convert
a
to a numpy array then index it.