title: Shifting columns in grouped pandas dataframe
body: <p>I have a dataframe which, after grouping it by <code>country</code> and <code>group</code>  looks like this:</p>
  <pre><code>                         A       B       C       D
  country     group
  1           a1           10      20      30      40
              a2           11      21      31      41
              a3           12      22      32      42
              a4           13      23      33      43
  
                           A       B       C       D
  country     group
  2           a1           50      60      70      80
              a2           51      61      71      81
              a3           52      62      72      82
              a4           53      63      73      83
  </code></pre>
  <p>My goal is to create another column <code>E</code> that would hold column <code>D</code> values shifted up by 1 row like so:</p>
  <pre><code>                         A       B       C       D      E
  country     group
  1           a1           10      20      30      40     41
              a2           11      21      31      41     42
              a3           12      22      32      42     43
              a4           13      23      33      43     nan
  
                           A       B       C       D      E
  country     group 
  2           a1           50      60      70      80     81
              a2           51      61      71      81     82
              a3           52      62      72      82     83
              a4           53      63      73      83     nan
  </code></pre>
  <p>What I've tried:</p>
  <p><code>df.groupby(['country','group']).sum().apply(lambda x['E']: x['D'].shift(-1))</code>
  but I get invalid syntax.</p>
  <p>Afterwards I am trying to delete those bottom lines in each group where <code>nan</code> is present like so:
  <code>df = df[~df.isin([np.nan]).any(1)]</code> which works.</p>
  <p>How can I add a column <code>E</code> to the <code>df</code> which would hold column <code>D</code> values shifted by <code>-1</code>?</p>