0
pd.read_csv("C:\Users\thesa\OneDrive\Desktop\Data Sets\datasets-session-16\subs.csv")

error

I was trying to read a csv file in jupyter notebook using pandas, but it is not working.

Kulasangar
  • 9,046
  • 5
  • 51
  • 82
  • This can help https://stackoverflow.com/a/1347854/13855094 – Krithick S Dec 29 '22 at 10:30
  • This can help too: https://clay-atlas.com/us/blog/2019/10/27/python-english-tutorial-solved-unicodeescape-error-escape-syntaxerror/ – Hansanho Dec 29 '22 at 10:32
  • Does this answer your question? [Error "(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape"](https://stackoverflow.com/questions/37400974/error-unicode-error-unicodeescape-codec-cant-decode-bytes-in-position-2-3) – Kulasangar Dec 29 '22 at 10:33

1 Answers1

1

Your problem is with the string

Here, \U in "C:\Users... starts an eight-character Unicode escape, such as \U00014321.

you can double the backslashes Or prefix the string with r

pd.read_csv("C:\\Users\\thesa\\OneDrive\\Desktop\\Data Sets\\datasets-session-16\\subs.csv")

pd.read_csv(r"C:\Users\thesa\OneDrive\Desktop\Data Sets\datasets-session-16\subs.csv")