I am trying to read this file of two columns into a dataframe. It doesn't read as datetime.
INPUT :
DATE DTB3
8/4/2014 0.0004
8/5/2014 0.0003
8/6/2014 0.0003
........
Using this code :
T1 = pd.read_csv(FRED_file,sep=',',header=None,names=['DATE','DTB3'],dtype= {'DATE':'str','DTB3':'str'},parse_dates=['DATE'],index_col='DATE')
T1.drop(T1.index[0],inplace=True)
T1.index = pd.to_datetime(T1.index, format = '%m/%d%Y')
T1.index = T1.index.strftime('%Y-%m-%d')
T1.index
Output :
Index(['2014-08-04', '2014-08-05', '2014-08-06', '2014-08-07', '2014-08-08',
'2014-08-11', '2014-08-12', '2014-08-13', '2014-08-14', '2014-08-15',
...
'2018-09-07', '2018-09-10', '2018-09-11', '2018-09-12', '2018-09-13',
'2018-09-14', '2018-09-17', '2018-09-18', '2018-09-19', '2018-09-20'],
dtype='object', length=1079)