0

I've been trying to import a csv file in to my Jupyter notebook and it just keeps throwing back the below error after inputting:

df = pd.read_csv(r'C:\Users\SHinton\Downloads\Checks.csv')

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\SHinton\Downloads\Checks.csv'

If I remove the 'r' it brings back this error:

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

Have been looking across the stack overflow message boards and the /,,\,//,r and = open methods haven't worked either so am a bit stumped by this. Any help welcome!

enter image description here enter image description here

enter image description here

Samgrill
  • 77
  • 6
  • I think if you don't use `r` you have to escape the backslashes like `'C:\\Users\\SHinton\\Downloads\\Checks.csv'`, but also the simplest thing to do would probably be to copy it to your working directory. You might also want to take a look at https://discourse.jupyter.org/t/accessing-local-folder-using-online-jupyter/9523 – Driftr95 Apr 03 '23 at 15:16
  • 1
    I don't think your last sentence is pertinent, @Driftr95 . I don't think JupyterLite is in use here. From the error 'SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes', it would seem OP is not specifying the right encoding here. I suspect they have weird characters in the CSV file. That is what they should be focusing on looking for more information about on StackOverflow, for example [here](https://stackoverflow.com/a/18172249/8508004) and [here](https://stackoverflow.com/a/53150824/8508004) and [here](https://stackoverflow.com/a/66765050/8508004). – Wayne Apr 03 '23 at 20:44

0 Answers0