0

When executing the following Python 3.6 code in Jupyter 5.000 notebook:

import pandas as pd
file = "C:\users\frogf\MSDS7333\data\HIGGS.csv"
data=pd.read_csv(file,nrows=N,header=None,encoding = "utf-8")

it gives the error:

 File "<ipython-input-5-204f62a7e8b4>", line 2
    file = "C:\users\frogf\MSDS7333\data\HIGGS.csv"
          ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \uXXXX escape
Ken Williams
  • 22,756
  • 10
  • 85
  • 147
frogfanitw
  • 165
  • 3
  • 8

1 Answers1

1

open the file as raw string. Try:

import pandas as pd
data=pd.read_csv(r"C:\users\frogf\MSDS7333\data\HIGGS.csv",nrows=10,header=None,encoding = "utf-8")