In [67]:
offline['CREATEDDATE'].head()
Out[67]:
0 01/05/06
1 11/22/03
2 10/31/07
3 02/05/10
4 05/16/05
Name: CREATEDDATE, dtype: object
In [68]:
offline['CREATEDDATE'] = pd.to_datetime(offline['CREATEDDATE'])
In [70]:
offline['CREATEDDATE'].head()
Out[70]:
0 01/05/06
1 11/22/03
2 10/31/07
3 02/05/10
4 05/16/05
Name: CREATEDDATE, dtype: object
答案 0 :(得分:0)
我测试了你的代码,它工作正常。我建议你检查一下Pandas的版本并在需要时进行升级。
#Check versions. I used 'pandas: 0.16.1', 'numpy: 1.9.2'
pd.show_versions()
df=pd.DataFrame(['01/05/06','11/22/03'], columns=['dates'])
#the format option can be omitted, but I include this for clarity
df['dates']=pd.to_datetime(df['dates'],format='%m/%d/%y')
df['dates']
#out: Name: dates, dtype: datetime64[ns]