title: Is there a more efficient and elegant way to filter pandas index by date?
body: <p>I often use DatetimeIndex.date, especially in groupby methods. However, DatetimeIndex.date is slow when compared to DatetimeIndex.year/month/day. From what I understand, it is because the .date attribute works with a lambda function over the index and returns a datetime ordered index, while index.year/month/day just returns integer indices. I have made a small example function that performs a bit better and would speed up some of my code (at least for finding the values in a groupby), but I feel that there must be a better way:</p>
  
  <pre><code>In [217]: index = pd.date_range('2011-01-01', periods=100000, freq='h')
  
  In [218]: data = np.random.rand(len(index))
  
  In [219]: df = pd.DataFrame({'data':data},index)
  
  In [220]: def func(df):
   ...:     groupby = df.groupby([df.index.year, df.index.month, df.index.day]).mean()
   ...:     index = pd.date_range(df.index[0], periods = len(groupby), freq='D')
   ...:     groupby.index = index
   ...:     return groupby
   ...: 
  
  In [221]: df.groupby(df.index.date).mean().equals(func(df))
  Out[221]: True
  
  In [222]: df.groupby(df.index.date).mean().index.equals(func(df).index)
  Out[222]: True
  
  In [223]: %timeit df.groupby(df.index.date).mean()
  1 loop, best of 3: 1.32 s per loop
  
  In [224]: %timeit func(df)
  10 loops, best of 3: 89.2 ms per loop
  </code></pre>
  
  <p>Does the pandas/index have a similar functionality that I am not finding?</p>