df.index[0] I want to be datetime.date(2006, 8, 27).
While reading from file, df = pd.read_csv(filePath,index_col="Date"), df.index[0] appears as string '2006-08-27'.
I tried:
dateparser = lambda s: datetime.datetime.strptime(s,"%Y-%m-%d").date()
df = pd.read_csv(filePath,parse_dates=["Date"], date_parser=dateparser,index_col="Date")
Now, df.index[0] appears as Timestamp('2006-08-27 00:00:00').
How to make df.index[0] as datetime.date(2006, 8, 27)?
used sample csv:
Date,Symbol,Series,Prev Close,Open,High,Low,Last,Close,VWAP,Volume,Turnover,Trades,Deliverable Volume,%Deliverble
2006-08-27,,,,,,,,,,,,,,
2006-08-28,ATFC,EQ,365.0,521.0,569.0,502.0,553.0,554.25,552.0,15166163,837176013020000.0,,3777529,0.24910000000000002
2006-08-29,ATFC,EQ,554.25,555.0,563.9,535.55,536.1,539.3,547.59,3929113,215153038915000.0,,727534,0.1852
2006-08-30,ATFC,EQ,539.3,537.0,542.9,521.5,529.0,528.1,529.55,2034983,107762957620000.0,,345064,0.1696
2006-08-31,ATFC,EQ,528.1,525.0,544.0,515.0,539.35,538.45,532.89,1670990,89044643830000.0,,286440,0.1714
2006-09-01,ATFC,EQ,538.45,539.0,549.0,535.1,541.35,541.85,542.46,1176195,63803856150000.0,,213842,0.1818