![](/img/trans.png)
[英]Python error "FileNotFoundError: [Errno 2] File b Usuarios.csv' does not exist: b Usuarios.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.