python 获取数字波峰及峰值

pip install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple
import datetime
import time

import pandas as pd
import matplotlib.pylab as plt
from pandas import DataFrame
from scipy import signal

if __name__ == '__main__':
    pass
    m = [1, 2, 3, 4, 1, 2, 3, 4, 100, 5, 6, 7, 8, 9, 101, 11, 12, 13, 14, 15, 16, 102, 17, 18, 19, 20]
    plt.plot(m)
    plt.show()
    num_peak_3: tuple = signal.find_peaks(m, distance=1)
    for i in num_peak_3[0]:
        print(m[i])

python 获取数字波峰及峰值_第1张图片

 python 获取数字波峰及峰值_第2张图片

 

你可能感兴趣的:(python,数据分析三剑客,python,开发语言,numpy)