繁体   English   中英

FileNotFoundError:[Errno 2] 文件 b'smallsample.csv' 不存在:b'smallsample.csv'

[英]FileNotFoundError: [Errno 2] File b'smallsample.csv' does not exist: b'smallsample.csv'

在 Google Colab 中,我安装了 google drive:

from google.colab import drive     #Mounted at gdrive(set directory)
drive.mount("/content/gdrive")

并设置我的路径来读取名为smallsample.csv的文件:

path ='gdrive/My Drive' #/data_analysis/datafiles/reports
df= pd.read_csv('smallsample.csv', sep=',') 

然而,它回来了

FileNotFoundError: [Errno 2] File b'smallsample.csv' does not exist: b'smallsample.csv'

如果我将r添加到df= pd.read_csv('smallsample.csv', sep=',') 我也尝试了其他帖子建议的一些方法,但都没有解决这个问题。 有人可以帮忙吗? 干杯。

分配path =...不会更改当前工作目录。 相反,请使用 Michael 建议的绝对路径,或使用以下方法更改工作目录:

%cd /content/gdrive/My Drive

您可以使用%pwd观察当前工作目录,使用%ls观察当前目录中的文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM