title: Python find second lowest value in list
body: <p>I have a list of lists, such that:</p>
  
  <pre><code>a = [[1,0.8,0.4,0.1,0.3,0.5,1],
       [1,0.8,0.5,0.0,0.3,0.5,1]],
       ........................]
  </code></pre>
  
  <p>As can be seen in <code>a[1]</code> there is a negative value in the array. At some point later on in my code, I subtract the lowest value away from a constant (in this case it is 1) within a loop, such that:</p>
  
  <pre><code>b = []
  for i in range(len(a)):
      b.append(1-min(a[i]))
  </code></pre>
  
  <p>However this presents a problem as in <code>a[1]</code> I want 1-0.1 and not 1-0.0. The value of 0.0 was originally a negative value (its a noisy data point) and so I used:</p>
  
  <pre><code>a[a&lt;0]=0.0
  </code></pre>
  
  <p>I cannot remove the value entirely using <code>a=a[a&gt;0.0]</code> as it is important that I keep all of the data points (these are y values that have corresponding x values). I would ideally like to ignore it rather then remove it.</p>
  
  <p>Is there a way I could achieve something like:</p>
  
  <pre><code>b = []
  for i in range(len(a)):
      b.append(1-min(a[i]) where min(a[i]) is greater than 0) # i.e. the lowest value that isn't 0
  </code></pre>