title: Find two local minima in python
body: <p>I have a list of t values. My code for finding the minima values is as follows;</p>
  
  <pre><code>for i in np.arange(0,499,1):
      if t[i]&lt;t[i-1] and t[i]&lt;t[i+1] :                       
          t_min.append(t[i])
  </code></pre>
  
  <p>My t values change every time and hence it may happen that one of the minima occurs at the beginning or end in that case this code would not work. So I need a general code which will work for any range of t values.</p>