title: Pandas groupby with dict
body: <p>Is it possible to use a dict to group on elements of a column? </p>
  
  <p>For example:</p>
  
  <pre><code>In [3]: df = pd.DataFrame({'A' : ['one', 'one', 'two', 'three','two', 'two', 'one', 'three'],
     ...:          'B' : np.random.randn(8)})
  In [4]: df
  Out[4]: 
         A         B
  0    one  0.751612
  1    one  0.333008
  2    two  0.395667
  3  three  1.636125
  4    two  0.916435
  5    two  1.076679
  6    one -0.992324
  7  three -0.593476
  
  In [5]: d = {'one':'Start', 'two':'Start', 'three':'End'}
  In [6]: grouped = df[['A','B']].groupby(d)
  </code></pre>
  
  <p>This (and other variations) returns an empty groupby object.  And my variations on using <code>.apply</code> all fail too.</p>
  
  <p>I'd like to match the values of column <code>A</code> to the keys of the dictionary and put rows into the groups defined by the values. The output would look something like this:</p>
  
  <pre><code> Start:
             A         B
      0    one  0.751612
      1    one  0.333008
      2    two  0.395667
      4    two  0.916435
      5    two  1.076679
      6    one -0.992324
  End:
             A         B
      3  three  1.636125
      7  three -0.593476
  </code></pre>