title: Get first value less than x using np.select / ValueError: -1 is not in range
body: <p>I have come across an issue with the <code>np.select</code> section of my code and have reproduced a minimal-reproducible-example to seek some advice as to why <code>ValueError: -1 is not in range</code> is being returned rather than <code>nan</code></p>
  <pre><code>import numpy as np
  import pandas as pd
  
  test = {'number' : [1,2,3,4,5,6]}
  df = pd.DataFrame(data=test)
  
  print(df)
  
  number = 1
  
  #check row index of first value less than 'number'
  print((np.abs(df['number']-number)).values.argmin()-1)
  
  conditions = [number &lt;= df['number'][3], number &gt; df['number'][3]]
  selection = [df['number'][(np.abs(df['number']-number)).values.argmin()-1], 'ignore'] # get first value in df['number'] column less than 'number' variable
  answer = np.select(conditions, selection, default=np.nan)
  
  print(answer)
  </code></pre>
  <p>Using <code>df['number'][3]</code> when <code>number = 1</code> I would expect to return <code>nan</code> since the value located in <code>df['number'][3]</code> is 4 and although <code>number = 1</code> is less than 4, there are is no row above the row index in <code>df['number']</code> where the value is <code>1</code></p>
  <p>Instead I get <code>ValueError: -1 is not in range</code> instead of <code>nan</code></p>