What I did when I stumbled upon mounting on MyDrive and loading an ipynb file in Google Colaboratory

Stumbling point 1: Mount on Google My Drive

The following resulted in an execution error

import os
os.chdir("./drive/My Drive/")

It worked well below

from google.colab import drive
drive.mount('/content/drive')

Stumbling point 2: Move directory in Google Drive

An error occurred when executing the directory move command in the Python os module. #### It worked well below I added a "!" And ran the bash command and it worked.

__ Below, * causal_inference * is the name of the directory created directly under Google My Drive. __

!cd("./drive/My Drive/causal_inference/")

Stumbling point 3: Loading iPython notebook file (extension: .ipynb)

I tried to read the iPython notebook file stored in the Google MyDrive directory with a command and execute it, but it didn't work.

It worked well below

By operating the button at the top of the screen of Coplaboratory with GUI, iPython notebook file could be loaded into Colaboratory.

__ "File" __-> __ "Upload Notebook" __-> __ Select "Google Drive" __-> __ Select an ipynb file saved in Google My Drive __

(Batch execution of ipynb files)

Below, you can execute all the code (in cells) contained in the iPython notebook file loaded into Colaboratory, all at once from top to bottom.

__ "Runtime" __-> __ "Run all cells" __

Recommended Posts

What I did when I stumbled upon mounting on MyDrive and loading an ipynb file in Google Colaboratory
What I did when I stumbled on a Django tutorial
What I stumbled upon when using CodeIgniter on a Linux server
An error that stumbled upon learning YOLO on Google Colab
When I get an error with Pylint in Atom on Windows
What I stumbled upon using Airflow