def moving_average(interval, windowsize): window = np.ones(int(windowsize)) / float(windowsize) re = np.convolve(interval, window, 'same') return re #寻找峰谷,并进行标记; sig = bodyPart4['dis'].to_numpy() sigAv = moving_average(sig, 3)#做一下简单的滑动平均 plt.plot(sigAv, 'g') np.savetxt(r"D:\PythonProject\QTNLS\resources\t7\hand-dis-ave.csv", sigAv, delimiter=",")