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


Groups > comp.lang.python > #97903 > unrolled thread

Re: Pandas' loading a CSV file problem

Started byMichiel Overtoom <motoom@xs4all.nl>
First post2015-10-22 15:23 +0200
Last post2015-10-22 15:23 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#97903 — Re: Pandas' loading a CSV file problem

FromMichiel Overtoom <motoom@xs4all.nl>
Date2015-10-22 15:23 +0200
SubjectRe: Pandas' loading a CSV file problem
Message-ID<mailman.101.1445520278.878.python-list@python.org>
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,



[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web