title: Determine if a value exists between two time points in Pandas
body: <p>I have a dataframe <code>blinded_SMBG_DF</code> with glucose values <code>blinded_SMBG_DF.Glucose</code> and timestamps as <code>index</code>. I need a piece of code that will check if there is an entry between two timestamps and if so report &quot;yes&quot; and if not report &quot;no&quot;.</p>
  <p>I tried the following:</p>
  <pre><code>if 0.1 &lt;= blinded_SMBG_DF.Glucose.loc['2021-01-08 08:30:00' : '2021-01-08 09:00:00'][0] &lt;= 100:
      print(&quot;yes&quot;)
  else:
      print(&quot;no&quot;)
  </code></pre>
  <p>and it works when there is a value in that range and prints &quot;yes&quot; but reports an error if there is no value in the df with that value. How do I change it so that instead of reporting an error it just reports &quot;no&quot; or NaN or something similar?</p>
  <p>Thanks so much.</p>