Python find special minimum of an array [duplicate]

感情迁移 提交于 2020-05-21 07:38:38

问题


Hi

i have a python price array like above image:

[100,120,135,150,190,200,180,150,200,220,300,280,250,270,320,380,400,390,380]

i want to find last minimum of array like red circle shown on the image.

result:250


回答1:


Find last relative minima:

from scipy.signal import argrelmin

values = [100,120,135,150,190,200,180,150,200,220,300,280,250,270,320,380,400,390,380]

values[argrelmin(values)[0][-1]]
>>> 250


来源:https://stackoverflow.com/questions/61644532/python-find-special-minimum-of-an-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!