title: How to create a new columns in grouped DataFrame?
body: <p>I have a DataFrame grouped by a categorical feature. 
  For example, I have df</p>
  
  <pre><code>df[['APP_NO', 'REPAY_METHOD', 'RESIDUAL_DEBT']] \
  .groupby(['APP_NO', 'REPAY_METHOD']).agg({'RESIDUAL_DEBT' : 'sum'}) 
  
  ID   NUM  CAT_FEAT   aggr  
  1   123   2         1233
  2   234   2         6631
  3   576   -1        -491
  4   987   0         5461
  </code></pre>
  
  <p>NUM is an unique identifier</p>
  
  <p>As a result, I want to get the following daraframe:</p>
  
  <pre><code>ID   NUM  CAT_FEAT   aggr_CF2   aggr_CF0   aggr_CFm1   
  1   123   2         1233           -1          -1
  2   234   2         6631           -1          -1
  3   576   -1          -1           -1          -491
  4   987   0           -1           5461        -1
  </code></pre>
  
  <p>That is, for each NUM, get the aggr tag with all CAT_FEAT values</p>
  
  <p>If NUM does not have any value from CAT_FEAT, then replace it with -1</p>
  
  <p>The question is how to implement this most correctly. The current df is already grouped by NUM. I have a DataFrame, without groupings. Maybe I initially did not think correctly.</p>