title: groupby shifting in pandas
body: <p>How do I turn this:</p>
  
  <pre><code> year artist           genre    genre_sales
   1999      A        Pop/Rock             10
   1999      B        Hip/Hop              15
   1999      C        Country               8            
   2000      A        Pop/Rock             11
   2000      B        Hip/Hop              14
   2000      D        Jazz                  1
   2001      B        Hip/Hop              18
   2001      C        Country              10
  </code></pre>
  
  <p>Into this:</p>
  
  <pre><code> year artist           genre    genre_sales
   1999      A        Pop/Rock            Nan 
   1999      B        Hip/Hop             Nan
   1999      C        Country             Nan
   2000      A        Pop/Rock             10
   2000      B        Hip/Hop              15
   2000      D        Jazz            (1999 Jazz sales despite D not releasing in '99)
   2001      B        Hip/Hop              14
   2001      C        Country         (2000 country values, not the 8 from '99)
  </code></pre>
  
  <p>I saw the groupby-shift question and cookbook page and assumed I could do something like:</p>
  
  <pre><code>df.groupby(['year','artist'])['genre_sales'].shift(1)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>df.groupby(['year','genre','artist'])['genre_sales'].shift(1)
  </code></pre>
  
  <p>but I think those would only work if artists produced one album per year.</p>
  
  <p>Current 'Genre Sales' is annual sales in the artist's genre for that year. I'm trying to get the PREVIOUS year's 'Genre Sales' in a row with each artist. Each genre will have multiple artists every year, and each artist could have zero or multiple entries in that genre in a given year.</p>