title: Pandas TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Int64Index'
body: <p>I've got some order data that I want to analyse. 
  Currently of interest is: How often has which SKU been bought in which month?</p>
  
  <p>Here a small example:</p>
  
  <pre><code>import datetime
  import pandas as pd
  import numpy as np
  
  d = {'sku': ['RT-17']}
  df_skus = pd.DataFrame(data=d)
  print(df_skus)
  
  d = {'date': ['2017/02/17', '2017/03/17', '2017/04/17', '2017/04/18', '2017/05/02'], 'item_sku': ['HT25', 'RT-17', 'HH30', 'RT-17', 'RT-19']}
  df_orders = pd.DataFrame(data=d)
  print(df_orders)
  
  for i in df_orders.index:
      print("\n toll")
      df_orders.loc[i,'date']=pd.to_datetime(df_orders.loc[i, 'date'])
  
  df_orders = df_orders[df_orders["item_sku"].isin(df_skus["sku"])]
  monthly_sales = df_orders.groupby(["item_sku", pd.Grouper(key="date",freq="M")]).size()
  monthly_sales = monthly_sales.unstack(0) 
  
  print(monthly_sales)
  </code></pre>
  
  <p>That works fine, but if I use my real order data (from CSV) I get after some minutes:</p>
  
  <blockquote>
    <p>TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Int64Index'  </p>
  </blockquote>
  
  <p>That problem comes from the line:</p>
  
  <blockquote>
    <p>monthly_sales = df_orders.groupby(["item_sku", pd.Grouper(key="date",freq="M")]).size()</p>
  </blockquote>
  
  <p>Is it possible to skip over the error?
  I tried a try except block:</p>
  
  <pre><code>try:
      monthly_sales = df_orders.groupby(["item_sku", pd.Grouper(key="date",freq="M")]).size()
      monthly_sales = monthly_sales.unstack(0) 
  except:
      print "\n Here seems to be one issue"
  </code></pre>
  
  <p>Then I get for the print(monthly_sales)</p>
  
  <blockquote>
    <p>Empty DataFrame<br>
    Columns: [txn_id, date, item_sku, quantity]<br>
    Index: []</p>
  </blockquote>
  
  <p>So something in my data empties or brakes the grouping it seems like?
  How can I 'clean' my data?<br>
  Or I'd be even fine with loosing the data of a sale here and there if I can just 'skip' over the error, is this possible?</p>