Syntax error in read_csv

when i run the following code i am getting a syntax erroe:
dx=pd.read_csv(“C:\Users\ravi\Downloads\Linear_X_Train.csv”)
dy=pd.read_csv(“C:\Users\ravi\Downloads\Linear_Y_Train.csv”)
dt=pd.read_csv(“C:\Users\ravi\Downloads\Linear_X_Test.csv”)
print(dx.head())
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape

Hello @ravisheoran,
Can you please provide the details into how you got the dataset?

I have downloaded that data from github and saved at the location specified in the code

use / , in place of \

Hello @ravisheoran,
Did you copied the content of the file into a text document and saved it as .csv?
If yes then, it is still being saved as a text document and that’s why its giving the encoding error.
You should download the file by,
Going into GitHub, and open the file where the .csv is present, while opening it, you will see at the right hand side, “Raw”.
There, right click on it and do save link as,
A Pop up will open, be sure that you select “All files” and type in the name field, “<your_filename>.csv”

Then try loading your file using read_csv.

Happy Learning :slight_smile:
Thanks

no i have downloaded the csv file directly from github and used it directly in the code by giving location of file but still getting error

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.