title: pandas filter dates to last most recent 3 months
body: <p>I want to filter a pandas data frame to the last most recent 3 months.</p>
  
  <pre><code>import pandas as pd
  dates = pd.DataFrame(['2016-11-01', '2016-12-01', '2017-01-01', '2017-02-01', '2017-03-01'], columns=['date'])
  dates.date = pd.DatetimeIndex(dates.date)
  import datetime
  today = datetime.date.today()
  first = today.replace(day=1)
  lastMonth = first - datetime.timedelta(days=90)
  print (lastMonth.strftime("%Y-%m"))
  dates[dates.date &gt;= lastMonth]
  </code></pre>
  
  <p>This snippet sort of already works, but has the length of a month hard coded to 30 days. How can I use a <code>pd.Timedelta('-3 month')</code> (which does not seem to work like this) to achieve a more robust function?</p>