title: Get index of a row of a pandas dataframe as an integer
body: <p>Assume an easy dataframe, for example</p>
  
  <pre><code>    A         B
  0   1  0.810743
  1   2  0.595866
  2   3  0.154888
  3   4  0.472721
  4   5  0.894525
  5   6  0.978174
  6   7  0.859449
  7   8  0.541247
  8   9  0.232302
  9  10  0.276566
  </code></pre>
  
  <p>How can I retrieve an index value of a row, given a condition?
  For example:
  <code>dfb = df[df['A']==5].index.values.astype(int)</code>
  returns <code>[4]</code>, but what I would like to get is just <code>4</code>. This is causing me troubles later in the code.</p>
  
  <p>Based on some conditions, I want to have a record of the indexes where that condition is fulfilled, and then select rows between. </p>
  
  <p>I tried</p>
  
  <pre><code>dfb = df[df['A']==5].index.values.astype(int)
  dfbb = df[df['A']==8].index.values.astype(int)
  df.loc[dfb:dfbb,'B']
  </code></pre>
  
  <p>for a desired output</p>
  
  <pre><code>    A         B
  4   5  0.894525
  5   6  0.978174
  6   7  0.859449
  </code></pre>
  
  <p>but I get <code>TypeError: '[4]' is an invalid key</code></p>