python 转折点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 转折点相关的知识,希望对你有一定的参考价值。

peaks, troughs = pivots(s, 10)

fig1 = plt.figure(figsize=(8,5))
#plt.plot(s)
s.plot()

for p in peaks:
    plt.plot(s.index[p], s[p], 'ro', markersize=8)
    plt.text(s.index[p], s[p], str(p), fontsize=10)
for t in troughs:
    plt.plot(s.index[t], s[t], 'go', markersize=8)
    plt.text(s.index[t], s[t], str(t), fontsize=10)
    
alt_peaks, alt_troughs = alternate_pivots(s, peaks, troughs)
    
fig2 = plt.figure(figsize=(8,5))
s.plot()

for p in alt_peaks:
    plt.plot(s.index[p], s[p], 'ro', markersize=8)
    plt.text(s.index[p], s[p], str(p), fontsize=10)
for t in alt_troughs:
    plt.plot(s.index[t], s[t], 'go', markersize=8)
    plt.text(s.index[t], s[t], str(t), fontsize=10)

以上是关于python 转折点的主要内容,如果未能解决你的问题,请参考以下文章

python 交替转折点(枢轴)

python 平均周期 - time_series转折点的平均持续时间t-p,p-t

#yyds干货盘点# 3. 无转折不编程,滚雪球学 Python

未来可期与君远航--2021年终总结

未来可期与君远航--2021年终总结

在 C 中找到函数的第一个转折点