title: Pandas (python) conditional row selection
body: <p>I searched this on stackoverflow and couldn't see a proper answer from some of the results I got. I am trying to learn pandas and goal is to find a particular value</p>
  <pre><code>import pandas as pd
  
  df_data = {
      &quot;age&quot;: [24, 9, 20, 24],
      &quot;weight&quot;: [170, 106, 201, 216],
      &quot;dob&quot;: [&quot;1/1990&quot;, &quot;1/2000&quot;, &quot;2/1994&quot;, &quot;1/1990&quot;]
  }
  
  df = pd.DataFrame(df_data) 
  </code></pre>
  <p>now I want to pick the rows with dob &gt;= &quot;1/1990&quot; and &lt;= &quot;1/2020&quot;. Then I have to pick the max weight and then print the corresponding age. This is what I am doing</p>
  <pre><code>weightMax = df[(df[&quot;dob&quot;] &gt;= &quot;1/1990&quot;) &amp; (df[&quot;dob&quot;] &lt;= &quot;1/2020&quot;)]
  index = weightMax[&quot;weight&quot;].idxmax()
  </code></pre>
  <p>if I print weightMax[index] for the whole row, it throws index outofbound error. where am I going wrong here?
  Also, to get the corresponding age, how do I get it?</p>
  <p>Thanks a lot for the help</p>