title: How to make Default Choice for np.select() a Previous Value of an Array, Series, or DataFrame
body: <p>I am using np.select() to construct an ndarray with values of either 1, -1, or 0, depending on some conditions. It is possible that none of these will be met, so I need a default value. I would like this value to be the value that the array holds in the previous index, if that makes sense. My naive code, which runs on some columns of a DataFrame named "total" and which raises an error, is below:</p>
  
  <pre><code>condlist = [total.ratios &gt; total.s_entry, total.ratios &lt; total.b_entry, (total.ratios &gt; total.b_entry) &amp; (total.ratios &lt; total.s_entry)]
  choicelist = (-1, 1, 0)
  pos1 = pd.Series(np.select(condlist, choicelist, pos1))
  </code></pre>
  
  <p>Is there a way to do what I am asking? For example, having the array start</p>
  
  <pre><code>1
  1
  0
  -1
  -1
  </code></pre>
  
  <p>and then the sixth element doesn't satisfy any of the conditions, so its value defaults to -1 due to that being the most recent value of the array?</p>