Last answered:

25 Nov 2022

Posted on:

15 Feb 2022

1

unable to load data set into jupyter notebook

After running this line of code ;
data = pd.read_csv("C:\Users\USER\Desktop 1.01. Simple linear regression");
 i get this syntax error

File "C:\Users\USER\AppData\Local\Temp/ipykernel_10208/1374974937.py", line 1
    data = pd.read_csv("C:\Users\USER\Desktop 1.01. Simple linear regression")


SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Thanks, I hope to get quick feedback from you regarding this issue.

4 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Feb 2022

1

Hey!

Substitute all backslash symbols \ with double backslashes such that the path looks as follows:
C:\\Users\\USER\\Desktop\\1.01. Simple linear regression.csv
To avoid entering the full path, put your notebook in the same folder as the .csv file. In that way, you would only need to specify the name of the database.

Kind regards,
365 Hristina

Posted on:

25 Nov 2022

0

What do you mean by put your notebook in the same folder ? Is it putting the CSV in the same folder or the notebook?

Posted on:

25 Nov 2022

0

image.png

Instructor
Posted on:

25 Nov 2022

0

Hey Martin,

Than you for reaching out!

What I meant is to put both the Jupyter notebook and the CSV file in the same folder, as demonstrated in the screenshot below.
image.png
Regarding the error on your screenshot, you should execute the code

import pandas as pd

before loading the data.

Hope this helps!

Kind regards,
365 Hristina

Submit an answer