Mounting Google Drive to Google Colaboratory
Saurish Srivastava / January 07, 2021
Everyone's faced it before. We add files to our local runtime and create our machine learning models, data analysis pipelines, or simply just execute code in Python through Google Colab. And we're happy! But then our runtime is disconnected and all our files are gone, poof! But there's a way we can eliminate this problem: by mounting our Google Drive to Google Colab.
First we need to load the drive helper and mount
from google.colab import drive
This next piece of code will prompt for authorization; follow the steps!
It's important to note that this will mount your drive at the location /content/drive – you still need to utilize %cd to change directories and navigate around your drive. Using %ls will give you an idea of the contents inside your drive and what folders you need to access.