0
import pandas as pd
csv_path="D:/arun/datasets/US Presidential Data.csv"
data=pd.read_csv(csv_path)

It is working properly, but the following code getting this error:

import pandas as pd
csv_path="D:/arun/textmining/r files/twitter_data_sets/GST/GST-28-08-2017/10-10-2017.csv"
data=pd.read_csv(csv_path)

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-3-a90c76559f26> in <module>()
      1 import pandas as pd
      2 csv_path="D:/arun/textmining/r files/twitter_data_sets/GST/GST-28-08-2017/10-10-2017.csv"
----> 3 data=pd.read_csv(csv_path)
Paul Hodges
  • 13,382
  • 1
  • 17
  • 36
arun
  • 23
  • 4
  • You have a folder like `/r files/` in your `csv_path`. That `r` might be creating issues. You can try re-naming that folder to something else. It should work. – Mayank Porwal Nov 23 '18 at 09:47

2 Answers2

0

It is an encoding error. I hope utf8 can handle that. Try

import pandas as pd
csv_path="D:/arun/datasets/US Presidential Data.csv"
data=pd.read_csv(csv_path,encoding='utf-8')
Hayat
  • 1,539
  • 4
  • 18
  • 32
0

Try this:

data = pd.read_csv(csv_path, encoding = "ISO-8859-1")

Or

data = pd.read_csv(csv_path, encoding = "utf-8")
Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51