Python: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Aditya Bhatt\\Desktop\\Aditya\\SampleData.csv'
Python: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Aditya Bhatt\\Desktop\\Aditya\\SampleData.csv'
所以,这是我的代码...
filename = r"C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv"
df = pd.read_csv(filename)
现在,它向我显示了这个错误:
FileNotFoundError: [Errno 2] No such file or directory:
'C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv'
文件位置为:“C:\Users\AdityaBhatt\Desktop\Aditya”[已确认]
文件名称:SampleData(.csv 文件)
我是 运行 Google Colab 上的代码
另外,我从互联网上得到了这个文件(如果有帮助的话)
给你。
How to deal with local files in Google Colab
由于 Colab 笔记本托管在 Google 的云服务器上,默认情况下无法直接访问本地驱动器上的文件(与计算机上托管的笔记本不同)或任何其他环境。
你必须加双反斜杠 \
而不是单反斜杠 \
所以应该是这样的:
C:\something\assd\dada\x.csv
所以,这是我的代码...
filename = r"C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv"
df = pd.read_csv(filename)
现在,它向我显示了这个错误:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Aditya Bhatt\Desktop\Aditya\SampleData.csv'
文件位置为:“C:\Users\AdityaBhatt\Desktop\Aditya”[已确认]
文件名称:SampleData(.csv 文件)
我是 运行 Google Colab 上的代码
另外,我从互联网上得到了这个文件(如果有帮助的话)
给你。 How to deal with local files in Google Colab
由于 Colab 笔记本托管在 Google 的云服务器上,默认情况下无法直接访问本地驱动器上的文件(与计算机上托管的笔记本不同)或任何其他环境。
你必须加双反斜杠 \
而不是单反斜杠 \
所以应该是这样的:
C:\something\assd\dada\x.csv