Search code examples
pythongoogle-colaboratory

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)


Solution

  • 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.