I have a number of excel files. In each file DATE is represented by
different name. I want to read the date from those different file. Also
the date is in different column in different file.
To identify the date field in different files I have created a file
called _globals where I keep all aliases for DATE in a array called
'alias_DATE'.
Array alias_DATE looks like,
alias_DATE=['TRADEDATE', 'Accounting Date', 'Date de VL','Datum',
'Kurs-datum', 'Date', 'Fecha Datos', 'Calculation Date', 'ClosingDate',
'Pricing Date', 'NAV Date', 'NAVDate', 'NAVDATE', 'ValuationDate' ,
'Datestamp', 'Fecha de Valoración', 'Kurs-','datum',
"""Kurs-\ndatum""", "Kurs-\ndatum"]
Now I want the index of the column where date is there. I followed the
with followin code.
u'Fecha de Valoraci\xf3n'
u'Fecha de Valoraci\xf3n'
Fecha de Valoración
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
UnicodeDecodeEr ror: 'ascii' codec can't decode byte 0xf3 in position
17: ordinal not in range(128)
Though I have matching value in the array, why I am getting this error.
Can any one please tell me why is this error, and how to get rid of
this error. Because I have some files which containing some more
special characters.
Thank you in advance.
Sudhir.
different name. I want to read the date from those different file. Also
the date is in different column in different file.
To identify the date field in different files I have created a file
called _globals where I keep all aliases for DATE in a array called
'alias_DATE'.
Array alias_DATE looks like,
alias_DATE=['TRADEDATE', 'Accounting Date', 'Date de VL','Datum',
'Kurs-datum', 'Date', 'Fecha Datos', 'Calculation Date', 'ClosingDate',
'Pricing Date', 'NAV Date', 'NAVDate', 'NAVDATE', 'ValuationDate' ,
'Datestamp', 'Fecha de Valoración', 'Kurs-','datum',
"""Kurs-\ndatum""", "Kurs-\ndatum"]
Now I want the index of the column where date is there. I followed the
with followin code.
>>b=xlrd.open_w orkbook('Santan der_051206.xls' )
>>sh=b.sheet_by _index(0)
>>sh.cell_value (rowx=0, colx=11)
>>sh=b.sheet_by _index(0)
>>sh.cell_value (rowx=0, colx=11)
>>val=sh.cell_v alue(rowx=0, colx=11)
>>val
>>val
>>print val
>>import _globals # the file where I have stored my 'alias_DATE' array
>>_globals.alia s_DATE.index(va l)
>>_globals.alia s_DATE.index(va l)
File "<interacti ve input>", line 1, in ?
UnicodeDecodeEr ror: 'ascii' codec can't decode byte 0xf3 in position
17: ordinal not in range(128)
>>>
Can any one please tell me why is this error, and how to get rid of
this error. Because I have some files which containing some more
special characters.
Thank you in advance.
Sudhir.
Comment