8

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
  • 4,406
  • 9
  • 38
  • 80
  • 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
  • 1
    Show us your code! – Klaus D. Mar 16 '19 at 03:53

1 Answers1

19

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
  • 1,010
  • 10
  • 20