title: How to extract values from a Pandas DataFrame, rather than a Series (without referencing the index)?
body: <p>I am trying to return a specific item from a Pandas DataFrame via conditional selection (and do not want to have to reference the index to do so).</p>
  
  <p>Here is an example:</p>
  
  <p>I have the following dataframe:</p>
  
  <pre><code>  Code  Colour  Fruit
  0   1   red     apple
  1   2   orange  orange
  2   3   yellow  banana
  3   4   green   pear
  4   5   blue    blueberry
  </code></pre>
  
  <p>I enter the following code to search for the code for blueberries:</p>
  
  <pre><code>df[df['Fruit'] == 'blueberry']['Code']
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>4    5
  Name: Code, dtype: int64
  </code></pre>
  
  <p>which is of type:</p>
  
  <pre><code>pandas.core.series.Series
  </code></pre>
  
  <p>but what I actually want to return is the number 5 of type:</p>
  
  <pre><code>numpy.int64
  </code></pre>
  
  <p>which I can do if I enter the following code:</p>
  
  <pre><code>df[df['Fruit'] == 'blueberry']['Code'][4]
  </code></pre>
  
  <p>i.e. referencing the index to give the number 5, but I do not want to have to reference the index!</p>
  
  <p>Is there another syntax that I can deploy here to achieve the same thing?</p>
  
  <p>Thank you!...</p>
  
  <p>Update:</p>
  
  <p>One further idea is this code:</p>
  
  <pre><code>df[df['Fruit'] == 'blueberry']['Code'][df[df['Fruit']=='blueberry'].index[0]]
  </code></pre>
  
  <p>However, this does not seem particularly elegant (and it references the index).  Is there a more concise and precise method that does not need to reference the index or is this strictly necessary?</p>
  
  <p>Thanks!...</p>