BUG: Add import for 'is_datetime64_dtype'
This import was missing from `core/groupby.py`. This also suggests that there is an issue with the test cases, given that no test triggers this issue (suggesting that there is no current test that triggers the `elif` condition below).

``` python
    def _try_cast(self, result, obj):
        """ try to cast the result to our obj original type,
        we may have roundtripped thru object in the mean-time """
        try:
            if obj.ndim > 1:
                dtype = obj.values.dtype
            else:
                dtype = obj.dtype

            if _is_numeric_dtype(dtype):

                # need to respect a non-number here (e.g. Decimal)
                if len(result) and issubclass(type(result[0]),(np.number,float,int)):
                    result = _possibly_downcast_to_dtype(result, dtype)

            elif issubclass(dtype.type, np.datetime64):
                if is_datetime64_dtype(obj.dtype):
                    result = result.astype(obj.dtype)
```

u could run coverage and see if it agrees with your suggestion
 @cpcloud Not necessary - the missing import is on master, if all the tests pass with the missing import, the line can't ever have been executed during the tests.
 ah yes indeed
 Looking at this now 

this can only be hit if the datetimes are not views and not datetime64[ns]
sometime which is not possible
I don't recall what happens to dt during groupby exactly ( whether they r converted with a view or not)
 Do you want to remove the line altogether?

On Sun, Jun 16, 2013 at 6:54 AM, jreback notifications@github.com wrote:

> Looking at this now
> 
> this can only be hit if the datetimes are not views and not datetime64[ns]
> sometime which is not possible
> I don't recall what happens to dt during groupby exactly ( whether they r
> converted with a view or not)
> 
> —
> Reply to this email directly or view it on GitHubhttps://github.com/pydata/pandas/pull/3920#issuecomment-19510774
> .
 I am not sure it is ever hit (as u have noticed)
let me see if I can figure out what it's supposed to do
 @jreback any luck here?
 tomorrow
 this was being called incorrectly (and uncessarily), then trapped by try: except, all fixed up; closing this PR (fixed in #3934)...thanks for finding this!
