Aditya Bhatt
Aditya Bhatt

Reputation: 11

Python: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Aditya Bhatt\\Desktop\\Aditya\\SampleData.csv'

So, here's my code...

filename = r"C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv" 
df = pd.read_csv(filename)

Now, it shows me this error:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv'

The file location is: "C:\Users\Aditya Bhatt\Desktop\Aditya"[Confirmed]
Name of File: SampleData (.csv file)

I'm running the code on Google Colab
Also, I got this file from the internet (If that helps)

Upvotes: 0

Views: 3404

Answers (2)

MrHola21
MrHola21

Reputation: 321

you have to put double back slashes \\ instead of single \

so it should be like this:

C:\something\assd\dada\x.csv

Upvotes: 1

Brad
Brad

Reputation: 56

here you go. How to deal with local files in Google Colab

Since a Colab notebook is hosted on Google’s cloud servers, there’s no direct access to files on your local drive (unlike a notebook hosted on your machine) or any other environment by default.

Upvotes: 0

Related Questions