title: How to get the Average of a specific category via Python
body: <p>I was wondering how I could calculate the average of a specific category via Python? I have a csv file called demo.csv</p>
  
  <pre><code> import pandas as pd
   import numpy as np
  
  #loading the data into data frame
  X = pd.read_csv('demo.csv')
  </code></pre>
  
  <p>the two columns of interest are the <code>Category</code> and <code>Totals</code> column:</p>
  
  <pre><code>Category Totals estimates
  2   2777    0.43
  4   1003    0.26
  4   3473    0.65
  4   2638    0.17
  1   2855    0.74
  0   2196    0.13
  0   2630    0.91
  2   2714    0.39
  3   2472    0.51
  0   1090    0.12
  </code></pre>
  
  <p>I'm interested in finding the average for the Totals corresponding with <code>Category</code> 2. I know how to do this on excel, I would just filter to only show category 2 and get the average(which ends up being 2745.5) but how would I code this via Python?</p>