title: Pandas : Problem with aggregation by periods of two months
body: <p>I want to aggregate data by periods of two months by using the groupby method of pandas. And I cannot achieve the exepected results. Indeed I have data that spans 4 months. Therefore I want two periods : the first one between 2018-06-01 and 2018-07-31 and the seconde one between 2018-08-01 and 2018-09-30. Below in the code, you will find the obtained and the expected results. Could you help me about this ? Thank you in advance ! </p>
  
  <pre><code># data sample
  data={'A': pd.to_datetime(['2018-06-01','2018-06-15','2018-07-01','2018-07-15','2018-08-01','2018-08-15','2018-09-01','2018-09-15','2018-09-30']),
            'B': [1,1,1,1,1,1,1,1,1]}
  
  #create dataframe
  test=pd.DataFrame.from_dict(data)
  
  #aggregation of data by period of two months
  test.groupby(pd.Grouper(key='A', freq='2M',closed="right")).sum()
  
  # The results
  
  #              B
  # A             
  # 2018-06-30   2
  # 2018-08-31   4
  # 2018-10-31   3
  
  #The expected results : 
  
  #              B
  # A             
  # 2018-07-31  4
  # 2018-09-30  5
  </code></pre>