title: Python - Get value from pandas dataframe by index condition
body: <p>I want to get an element out of a dataframe by a condition, like this:</p>
  
  <pre><code>elem = df[(df['id']==enum['properties']['property2']) &amp; (df['time']==10)].col3
  </code></pre>
  
  <p>Since it's impossible for Python to know if this will return just one or a bunch of rows, it returns this as</p>
  
  <pre><code>6244    52.45
  Name: col3, dtype: float64
  </code></pre>
  
  <p>But I know there's only going to be one element like this. How can I make it so that <code>elem</code> only contains <code>52.45</code>?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The answer by Julien Marrec works fine in a single line, but not in the following loop:</p>
  
  <pre><code>for enum in data['features']:
      elem = df[(df['id']==enum['properties']['property2']) &amp; (df['time']==10)].col3.values[0]
  </code></pre>
  
  <p>It gives me an <code>IndexError: index 0 is out of bounds for axis 0 with size 0.</code></p>