AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() You should now have the file uploaded in your Google Drive.Run the cell with the pd.read_csv function call.Paste that file path into your pd.read_csv() call.Right click the File (or use the three dots action menu) and select Copy Path. ![]() Right click the folder /drive/My Drive or click the three dots action menu and select Upload. The drive now appears in the file browser.Grant the permissions and copy and paste the code into the text input. You are prompted to accept permissions and get a token to use to mount the drive. This inserts a new cell in your notebook with the code: Click the icon that says Mount Drive when hovered.I will explain the steps and include a screen shot. ![]() These concerns are, one, making certain that your file is accessible via google drive from your Collab notebook and also, two, making certain that your file is in the correct format. As some of the previous responders posted there are concerns that influence your ability to read the file. Could that be the problem? I have no other ideas. Why can't google colab just read the file stored on drive? Or am I doing something wrong? Another thing is that I uploaded a bunch of csv files, but google drive lists them as ".csv.gsheet" (using glob). I don't get why you would have to copy back and forth files, since I need to iterate over all the files on the folder. But it is done by copy file from Google Drive to Google Drive. I have seen some suggestin to use PyDrive. I always get "operation not supported" or "cannot open file for reading". !cp "/content/drive/My Drive/filename.ext" "filename.ext"įile = pd.read_csv("/content/drive/My Drive/filename.ext")īut none of the above worked. I already tried: with open("/content/drive/My Drive/filename.ext", "r") as file:įile = open("/content/drive/My Drive/filename.ext", "r") I already did as instructed using: from lab import driveĪfter this, I can use !ls to list the contents of my drive but I cannot read or open any file. I Have read the notebook about how to open drive.
0 Comments
Read More
Leave a Reply. |