title: How to select rows based categories in Pandas dataframe
body: <p>this is really trivial but can't believe I have wandered around for an hour and still can find the answer, so here you are:</p>
  
  <pre><code>    df = pd.DataFrame({"cats":["a","b"], "vals":[1,2]})
      df.cats = df.cats.astype("category")
      df
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6J8Ko.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6J8Ko.png" alt="df looks like this"></a></p>
  
  <p>My problem is how to select the row that its "cats" columns's category is "a". I know that <code>df.loc[df.cats == "a"]</code> will work but it's based on equality on element. Is there a way to select based on levels of category? </p>