title: How to group by first 2 words in a pandas dataframe column and count?
body: <p>I have a dataframe that looks like this:</p>
  
  <pre><code>dfx = pd.DataFrame({'id' : ['blue apple werewolf', 'blue apple cat',
  'yellow tangerine','blue apple dog', 'orange dog nectarine','black', 'green apple cat'] })
  </code></pre>
  
  <p>I want to group by the first 2 words per row in the <code>id</code> column and return a count of items that begin with those two words. If a column value doesn't have 2 words, it should only count the first word.</p>
  
  <p>So the resulting dataframe should look like:</p>
  
  <pre><code>ID             COUNT
  blue apple         3
  yellow tangerine   1
  orange dog         1
  green apple        1
  black              1
  </code></pre>
  
  <p>Any help?</p>