Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnicodeDecodeError with pandas.read_sql

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

Am seeing the above error in this simple SQL query:

df = pd.read_sql(query,connection)

I tried the query normally on SQL developer and it works perfectly fine. I am 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

like image 772
spiff Avatar asked Oct 25 '16 04:10

spiff


1 Answers

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.

like image 184
Hisham Karam Avatar answered Sep 24 '22 03:09

Hisham Karam