spiff spiff - 7 months ago 172
Python Question

UnicodeDecodeError with pandas.read_sql

UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 8: character maps to <undefined>

Am seeing teh above error in a simple sql query:

df = pd.read_sql(query,connection)

I tried the query normally on sql developer and it works perfectly fine.. really stumped here as to how to specify encoding in a read_sql call

Am using Python 3.4 and pandas version 0.14.1

Thanks very much!


the proper encoding for your database is iso-8859-1 according to oracle docs so When you connect() to your database, pass the charset='iso-8859-1' or encoding='iso-8859-1' try both.