title: pandas: pd.grouper trouble grouping by end of year date
body: <p>I have the following data frame:</p>
  
  <pre><code>url='https://raw.githubusercontent.com/108michael/ms_thesis/master/pacs.can.cl.abbridged'
  
  df=pd.read_csv('https://raw.githubusercontent.com/108michael/ms_thesis/master/pacs.can.cl.abbridged')
  
  df= df.set_index(pd.to_datetime(df['date']), inplace=False)
  
  df.head(3)
  
      cycle   pacid   cid     amount  date    catcode     type    di  feccandid   amtsum
  date                                        
  2010-10-13  2010    C00000901   N00031317   1000    2010-10-13  B2000   24K     D   H0FL19080   3000
  2009-03-23  2010    C00082917   N00027464   5000    2009-03-23  B1000   24K     D   H6IA01098   3500
  2009-05-13  2010    C00034405   N00024875   1000    2009-05-13  A5200   24K     D   H2IL08088   2000
  </code></pre>
  
  <p>Below I perform a group-by:</p>
  
  <pre><code> df['amtsum'] = df.groupby([pd.Grouper(level='date', freq='A'), 'catcode',\
      'type', 'pacid', 'di', 'feccandid']).amount.transform('sum')
  
      cycle   pacid   cid     amount  date    catcode     type    di  feccandid   amtsum
  date                                        
  2010-10-13  2010    C00000901   N00031317   1000    2010-10-13  B2000   24K     D   H0FL19080   3000
  2009-03-23  2010    C00082917   N00027464   5000    2009-03-23  B1000   24K     D   H6IA01098   3500
  2009-05-13  2010    C00034405   N00024875   1000    2009-05-13  A5200   24K     D   H2IL08088   2000
  
  ​
  </code></pre>
  
  <p>I would like for the <code>date index</code> to end on the end of the year, e.g. <code>2010-12-31</code>. I had this problem <a href="https://stackoverflow.com/questions/36059477/how-to-start-time-group-on-a-specific-date-pandas/36060065#36060065">before</a> and I got a working solution. Unfortunately, now that I am revisiting this part  of my code the solution is no longer working. I have also tried the following:</p>
  
  <pre><code>df['amtsum'] = df.groupby([pd.TimeGrouper('12M', closed='left'), 'catcode',\
  'type', 'pacid', 'di', 'feccandid']).amount.transform('sum')
  
  df.head(3)
      cycle   pacid   cid     amount  date    catcode     type    di  feccandid   amtsum
  date                                        
  2010-10-13  2010    C00000901   N00031317   1000    2010-10-13  B2000   24K     D   H0FL19080   1000
  2009-03-23  2010    C00082917   N00027464   5000    2009-03-23  B1000   24K     D   H6IA01098   3500
  2009-05-13  2010    C00034405   N00024875   1000    2009-05-13  A5200   24K     D   H2IL08088   1000
  
  ​
  </code></pre>
  
  <p>but the results are still not what I am looking for.
  Does anyone have a clue on this?</p>