why is my jupyter notebook not executing the csv file as show in the video
data=pd.read_csv('C:\Users\admin\Desktop\1.01.Simple_linear_regression.csv')
File "<ipython-input-29-05428c3bab10>", line 1 data=pd.read_csv('C:\Users\admin\Desktop\1.01.Simple_linear_regression.csv') ^ data
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
1 answers ( 0 marked as helpful)
Hi Falki,
This error occurs because you are using a normal string as a path. You can use one of the three following solutions to fix your problem:
1: Just put
r
before your normal string it converts normal string to raw string:
pandas.read_csv(r'C:\Users\admin\Desktop\1.01.Simple_linear_regression.csv')
2: Alternatively, you need to inverse the slashes and write:
pandas.read_csv(C:/Users/admin/Desktop/1.01.Simple_linear_regression.csv')
Best,
Iliya