5

I am trying to try pandas methods in a csv file I've made which looks like:

Location  Time    Number
Seoul     Nov.11     5
Jinju      dec.22    2
wpg                  3
          june.6     2

something like this. It is giving me an error message in the title. How can I fix this and what position is it referring exactly?

haneulkim
  • 3,674
  • 6
  • 21
  • 54
  • the file has characters which cannot be parsed by the utf8 codec ... open your csv in notepad++ and select `encode > encode in utf8` ... it might work then ... its hard to diagnose encoding errors without the real data – Joran Beasley Mar 16 '19 at 03:37
  • Show us your code! – Klaus D. Mar 16 '19 at 03:53

1 Answers1

12

According to https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html , you can add encoding parameter when reading the CSV file. I suggest you add "utf-8" or "ISO-8859-1".

pandas.read_csv(yourfile, encoding="utf-8")

or

pandas.read_csv(yourfile, encoding="ISO-8859-1")
taipei
  • 765
  • 8
  • 17