Code Sample, a copy-pastable example if possible

import pandas as pd
df = pd.DataFrame({'a': [1, 1, 2, 2], 'b': pd.to_datetime(['a', 'a', '12-23-2015', '12-24-2015'],
                  errors='coerce')})
df.groupby('a').b.first().dtype 

Expected Output

last line is supposed to show datetime64[ns] but it actually is float64 this only happens when the entire group has NaT datetime

output of pd.show_versions()

INSTALLED VERSIONS

commit: None python: 3.5.1.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None

pandas: 0.18.1 nose: 1.3.7 pip: 8.1.2 setuptools: 25.0.0 Cython: 0.24.1 numpy: 1.11.0 scipy: 0.17.0 statsmodels: 0.6.1 xarray: None IPython: 5.0.0 sphinx: None patsy: 0.4.1 dateutil: 2.5.3 pytz: 2016.4 blosc: None bottleneck: None tables: 3.2.3 numexpr: 2.5.2 matplotlib: 1.5.1 openpyxl: 2.3.5 xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None httplib2: 0.9.2 apiclient: 1.5.0 sqlalchemy: 1.0.14 pymysql: None psycopg2: 2.6.2 (dt dec pq3 ext lo64) jinja2: 2.8 boto: None pandas_datareader: None

Comment From: jreback

In [9]: df = pd.DataFrame({'a': [1, 1, 2, 2], 'b': pd.to_datetime(['a', 'a', '12-23-2015', '12-24-2015'],
   ...:                   errors='coerce')})
   ...: df.groupby('a').b.first()
   ...: 
Out[9]: 
a
1          NaT
2   2015-12-23
Name: b, dtype: datetime64[ns]

dupe of #12821, fixed by #12941 in master/0.19.0 (soon)