In the dataframe below, the 3rd line is the header and the Y, M and D columns are giving year month and day respectively. However, I am not able to read them in using this code:
df = pandas.read_csv(file_name, skiprows = 2, index_col='datetime',
parse_dates={'datetime': [0,1,2]},
date_parser=lambda x: pandas.datetime.strptime(x, '%Y %m %d'))
OTH-000.opc
XKN1= 0.500000E-01
Y M D PRCP VWC1
2006 1 1 0.0 0.17608E+00
2006 1 2 6.0 0.21377E+00
2006 1 3 0.1 0.22291E+00
2006 1 4 3.0 0.23460E+00
2006 1 5 6.7 0.26076E+00
I get a KeyError: List index out of range. Any suggestions?