Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97903

Re: Pandas' loading a CSV file problem

Subject Re: Pandas' loading a CSV file problem
From Michiel Overtoom <motoom@xs4all.nl>
Date 2015-10-22 15:23 +0200
References <CA+ZkTxvHO802k+3WC_E5StvH37vF6qF-=_ibs4kN_NodHz9EYQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.101.1445520278.878.python-list@python.org> (permalink)

Show all headers | View raw


Hi Ek,

> On 22 Oct 2015, at 14:44, Ek Esawi <esawiek@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,



Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pandas' loading a CSV file problem Michiel Overtoom <motoom@xs4all.nl> - 2015-10-22 15:23 +0200

csiph-web