title: Count number of counties per state using python {census}
body: <p>I am troubling with counting the number of counties using famous <a href="http://www.census.gov/popest/data/counties/totals/2015/CO-EST2015-alldata.html" rel="nofollow noreferrer">cenus.csv</a> data.</p>
  
  <p>Task:  Count number of counties in each state.</p>
  
  <p>Facing comparing (I think) / Please read below?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>df = pd.read_csv('census.csv')
  dfd = df[:]['STNAME'].unique()  //Gives out names of state
  
  serr = pd.Series(dfd)  // converting to series (from array)
  </code></pre>
  
  <p>After this, i've tried using two approaches:</p>
  
  <p>1:</p>
  
  <pre><code>    df[df['STNAME'] == serr] **//ERROR: series length must match**
  </code></pre>
  
  <p>2:   </p>
  
  <pre><code>i = 0
  for name in serr:                        //This generate error 'Alabama'
      df['STNAME'] == name
      for i in serr:
          serr[i] == serr[name]
          print(serr[name].count)
          i+=1
  </code></pre>
  
  <p>Please guide me; it has been three days with this stuff.</p>