问题
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