Pandas' loading a CSV file problem

Michiel Overtoom motoom at xs4all.nl
Thu Oct 22 09:23:27 EDT 2015


Hi Ek,

> On 22 Oct 2015, at 14:44, Ek Esawi <esawiek at gmail.com> wrote:
> 
> f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp1.csv')
> File "pandas\parser.pyx", line 1382, in pandas.parser._string_box_utf8 (pandas\parser.c:17655)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 8: invalid start byte

I guess you're on Windows and your CSV file is encoded as Windows-1252. Unless you tell Pandas this it'll assume your file is utf-8 encoded.

Try this:

   f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp1.csv', encoding='windows-1252')

Greetings,







More information about the Python-list mailing list