title: How do I group my data-set by month and apply SUM aggregation using Pandas/Python
body: <p>I have the following Data-set df:</p>
  
  <pre><code>| date      | Revenue |
  |-----------|---------|
  | 6/1/2017  | 100     |
  | 5/21/2017 | 200     |
  | 5/20/2017 | 300     |
  | 6/22/2017 | 400     |
  | 6/20/2017 | 500     |
  </code></pre>
  
  <p>I need to group the above data by month and write Python code to get the following output:</p>
  
  <pre><code>| date | SUM(Revenue) |
  |------|--------------|
  | May  | 500          |
  | June | 1000         |
  </code></pre>
  
  <p>I tried with the following code but got an error:</p>
  
  <pre><code>import pandas as pd
  files='C:\\Users\\Month.csv'
  df = pd.read_csv(files, parse_dates=['date'])
  df = df.convert_objects(convert_numeric=True)
  pd.to_datetime(df['date'], format = '%Y%m%d')
  df2=df.sort_values('date',ascending=True)
  df2.groupby(pd.TimeGrouper(freq='M')).sum()
  </code></pre>